forked from TrueCloudLab/frostfs-contract
[#215] container/tests: add helper for dummy container creation
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
72da098876
commit
53f102344f
1 changed files with 10 additions and 19 deletions
|
@ -145,15 +145,19 @@ func TestContainerPut(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestContainerDelete(t *testing.T) {
|
func addContainer(t *testing.T, c, cBal *neotest.ContractInvoker) (neotest.Signer, testContainer) {
|
||||||
c, cBal := newContainerInvoker(t)
|
|
||||||
|
|
||||||
acc := c.NewAccount(t)
|
acc := c.NewAccount(t)
|
||||||
cnt := dummyContainer(acc)
|
cnt := dummyContainer(acc)
|
||||||
|
|
||||||
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
||||||
c.Invoke(t, stackitem.Null{}, "put", cnt.value, cnt.sig, cnt.pub, cnt.token)
|
c.Invoke(t, stackitem.Null{}, "put", cnt.value, cnt.sig, cnt.pub, cnt.token)
|
||||||
|
return acc, cnt
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestContainerDelete(t *testing.T) {
|
||||||
|
c, cBal := newContainerInvoker(t)
|
||||||
|
|
||||||
|
acc, cnt := addContainer(t, c, cBal)
|
||||||
cAcc := c.WithSigners(acc)
|
cAcc := c.WithSigners(acc)
|
||||||
cAcc.InvokeFail(t, common.ErrAlphabetWitnessFailed, "delete",
|
cAcc.InvokeFail(t, common.ErrAlphabetWitnessFailed, "delete",
|
||||||
cnt.id[:], cnt.sig, cnt.token)
|
cnt.id[:], cnt.sig, cnt.token)
|
||||||
|
@ -172,11 +176,7 @@ func TestContainerDelete(t *testing.T) {
|
||||||
func TestContainerOwner(t *testing.T) {
|
func TestContainerOwner(t *testing.T) {
|
||||||
c, cBal := newContainerInvoker(t)
|
c, cBal := newContainerInvoker(t)
|
||||||
|
|
||||||
acc := c.NewAccount(t)
|
acc, cnt := addContainer(t, c, cBal)
|
||||||
cnt := dummyContainer(acc)
|
|
||||||
|
|
||||||
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
|
||||||
c.Invoke(t, stackitem.Null{}, "put", cnt.value, cnt.sig, cnt.pub, cnt.token)
|
|
||||||
|
|
||||||
t.Run("missing container", func(t *testing.T) {
|
t.Run("missing container", func(t *testing.T) {
|
||||||
id := cnt.id
|
id := cnt.id
|
||||||
|
@ -191,12 +191,7 @@ func TestContainerOwner(t *testing.T) {
|
||||||
func TestContainerGet(t *testing.T) {
|
func TestContainerGet(t *testing.T) {
|
||||||
c, cBal := newContainerInvoker(t)
|
c, cBal := newContainerInvoker(t)
|
||||||
|
|
||||||
acc := c.NewAccount(t)
|
_, cnt := addContainer(t, c, cBal)
|
||||||
cnt := dummyContainer(acc)
|
|
||||||
|
|
||||||
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
|
||||||
|
|
||||||
c.Invoke(t, stackitem.Null{}, "put", cnt.value, cnt.sig, cnt.pub, cnt.token)
|
|
||||||
|
|
||||||
t.Run("missing container", func(t *testing.T) {
|
t.Run("missing container", func(t *testing.T) {
|
||||||
id := cnt.id
|
id := cnt.id
|
||||||
|
@ -234,11 +229,7 @@ func dummyEACL(containerID [32]byte) eacl {
|
||||||
func TestContainerSetEACL(t *testing.T) {
|
func TestContainerSetEACL(t *testing.T) {
|
||||||
c, cBal := newContainerInvoker(t)
|
c, cBal := newContainerInvoker(t)
|
||||||
|
|
||||||
acc := c.NewAccount(t)
|
acc, cnt := addContainer(t, c, cBal)
|
||||||
cnt := dummyContainer(acc)
|
|
||||||
balanceMint(t, cBal, acc, containerFee*1, []byte{})
|
|
||||||
|
|
||||||
c.Invoke(t, stackitem.Null{}, "put", cnt.value, cnt.sig, cnt.pub, cnt.token)
|
|
||||||
|
|
||||||
t.Run("missing container", func(t *testing.T) {
|
t.Run("missing container", func(t *testing.T) {
|
||||||
id := cnt.id
|
id := cnt.id
|
||||||
|
|
Loading…
Reference in a new issue