[#194] container: Fix tests

One can't register domain in advance when zone
owner is container contract.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-12-08 15:39:18 +03:00 committed by Alex Vanin
parent 2ff25b5985
commit 39fc2b8ac4

View file

@ -124,30 +124,23 @@ func TestContainerPut(t *testing.T) {
cnt.value[len(cnt.value)-1] = 10 cnt.value[len(cnt.value)-1] = 10
cnt.id = sha256.Sum256(cnt.value) cnt.id = sha256.Sum256(cnt.value)
t.Run("bad domain owner", func(t *testing.T) { cNNS.Invoke(t, true, "register",
c1 := cNNS.WithSigners(acc, c.Committee) "cdn", c.CommitteeHash,
c1.Invoke(t, true, "register", "whateveriwant@world.com", int64(0), int64(0), int64(0), int64(0))
"baddomain.neofs", acc.ScriptHash(),
"whateveriwant@world.com", int64(0), int64(0), int64(0), int64(0))
cAcc.InvokeFail(t, "committee or container contract must own registered domain",
"putNamed",
cnt.value, cnt.sig, cnt.pub, cnt.token, "baddomain", "neofs")
})
cNNS.Invoke(t, true, "register", cNNS.Invoke(t, true, "register",
"second.neofs", c.CommitteeHash, "domain.cdn", c.CommitteeHash,
"whateveriwant@world.com", int64(0), int64(0), int64(0), int64(0)) "whateveriwant@world.com", int64(0), int64(0), int64(0), int64(0))
balanceMint(t, cBal, acc, (containerFee+containerAliasFee)*1, []byte{}) balanceMint(t, cBal, acc, (containerFee+containerAliasFee)*1, []byte{})
putArgs := []interface{}{cnt.value, cnt.sig, cnt.pub, cnt.token, "second", "neofs"} putArgs := []interface{}{cnt.value, cnt.sig, cnt.pub, cnt.token, "domain", "cdn"}
c2 := c.WithSigners(c.Committee, acc) c2 := c.WithSigners(c.Committee, acc)
c2.Invoke(t, stackitem.Null{}, "putNamed", putArgs...) c2.Invoke(t, stackitem.Null{}, "putNamed", putArgs...)
expected = stackitem.NewArray([]stackitem.Item{ expected = stackitem.NewArray([]stackitem.Item{
stackitem.NewByteArray([]byte(base58.Encode(cnt.id[:])))}) stackitem.NewByteArray([]byte(base58.Encode(cnt.id[:])))})
cNNS.Invoke(t, expected, "resolve", "second.neofs", int64(nns.TXT)) cNNS.Invoke(t, expected, "resolve", "domain.cdn", int64(nns.TXT))
}) })
}) })
} }