forked from TrueCloudLab/frostfs-contract
tests: Move owner ID calculation to a separate function
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
6e8ae742ae
commit
2b1fa53b67
2 changed files with 7 additions and 5 deletions
|
@ -58,8 +58,12 @@ func newContainerInvoker(t *testing.T) (*neotest.ContractInvoker, *neotest.Contr
|
|||
}
|
||||
|
||||
func setContainerOwner(c []byte, acc neotest.Signer) {
|
||||
copy(c[6:], signerToOwner(acc))
|
||||
}
|
||||
|
||||
func signerToOwner(acc neotest.Signer) []byte {
|
||||
owner, _ := base58.Decode(address.Uint160ToString(acc.ScriptHash()))
|
||||
copy(c[6:], owner)
|
||||
return owner
|
||||
}
|
||||
|
||||
type testContainer struct {
|
||||
|
@ -268,7 +272,7 @@ func TestContainerOwner(t *testing.T) {
|
|||
c.InvokeFail(t, container.NotFoundError, "owner", id[:])
|
||||
})
|
||||
|
||||
owner, _ := base58.Decode(address.Uint160ToString(acc.ScriptHash()))
|
||||
owner := signerToOwner(acc)
|
||||
c.Invoke(t, stackitem.NewBuffer(owner), "owner", cnt.id[:])
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-contract/container"
|
||||
"github.com/mr-tron/base58"
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
"github.com/nspcc-dev/neo-go/pkg/encoding/address"
|
||||
"github.com/nspcc-dev/neo-go/pkg/neotest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
|
@ -57,7 +55,7 @@ func TestFrostFSID_AddKey(t *testing.T) {
|
|||
pubs[i] = p.PublicKey().Bytes()
|
||||
}
|
||||
acc := e.NewAccount(t)
|
||||
owner, _ := base58.Decode(address.Uint160ToString(acc.ScriptHash()))
|
||||
owner := signerToOwner(acc)
|
||||
e.Invoke(t, stackitem.Null{}, "addKey", owner,
|
||||
[]interface{}{pubs[0], pubs[1]})
|
||||
|
||||
|
|
Loading…
Reference in a new issue