frostfs-sdk-go/object/object_test.go
Pavel Karpy 1186f2f703 [#170] oid, cid: Add marshal format checks
Also add checking presence of the `oid`, `cid` fields via `set` flag.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
2022-04-13 17:32:25 +03:00

26 lines
561 B
Go

package object_test
import (
"testing"
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
"github.com/nspcc-dev/neofs-sdk-go/object"
ownertest "github.com/nspcc-dev/neofs-sdk-go/owner/test"
"github.com/stretchr/testify/require"
)
func TestInitCreation(t *testing.T) {
var o object.Object
cnr := cidtest.ID()
own := *ownertest.ID()
object.InitCreation(&o, object.RequiredFields{
Container: cnr,
Owner: own,
})
cID, set := o.ContainerID()
require.True(t, set)
require.Equal(t, cnr, cID)
require.Equal(t, &own, o.OwnerID())
}