frostfs-sdk-go/subnet/subnet_test.go
Evgenii Baidakov 36b1e8442c
tests: Use dedicated function to generate signers in tests
Signed-off-by: Evgenii Baidakov <evgenii@nspcc.io>
2023-04-26 15:03:55 +04:00

48 lines
1,018 B
Go

package subnet_test
import (
"testing"
. "github.com/nspcc-dev/neofs-sdk-go/subnet"
subnetid "github.com/nspcc-dev/neofs-sdk-go/subnet/id"
subnetidtest "github.com/nspcc-dev/neofs-sdk-go/subnet/id/test"
subnettest "github.com/nspcc-dev/neofs-sdk-go/subnet/test"
usertest "github.com/nspcc-dev/neofs-sdk-go/user/test"
"github.com/stretchr/testify/require"
)
func TestInfoZero(t *testing.T) {
var info Info
require.Zero(t, info.ID())
require.True(t, subnetid.IsZero(info.ID()))
}
func TestInfo_SetID(t *testing.T) {
id := subnetidtest.ID()
var info Info
info.SetID(id)
require.Equal(t, id, info.ID())
require.True(t, AssertReference(info, id))
}
func TestInfo_SetOwner(t *testing.T) {
id := *usertest.ID(t)
var info Info
info.SetOwner(id)
require.Equal(t, id, info.Owner())
require.True(t, AssertOwnership(info, id))
}
func TestInfo_Marshal(t *testing.T) {
info := subnettest.Info(t)
var info2 Info
require.NoError(t, info2.Unmarshal(info.Marshal()))
require.Equal(t, info, info2)
}