frostfs-sdk-go/subnet/subnet_test.go
Alex Vanin 94476f9055 Rename package name
Due to source code relocation from GitHub.

Signed-off-by: Alex Vanin <a.vanin@yadro.com>
2023-03-07 15:47:21 +03:00

48 lines
1 KiB
Go

package subnet_test
import (
"testing"
. "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/subnet"
subnetid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/subnet/id"
subnetidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/subnet/id/test"
subnettest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/subnet/test"
usertest "git.frostfs.info/TrueCloudLab/frostfs-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()
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()
var info2 Info
require.NoError(t, info2.Unmarshal(info.Marshal()))
require.Equal(t, info, info2)
}