forked from TrueCloudLab/frostfs-sdk-go
df5c69eea5
All NeoFS object must have at least container and owner identifiers. Add `InitCreation` function which write all required fields to the object instance. Extend `Object` type docs with all the constructors. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
24 lines
524 B
Go
24 lines
524 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,
|
|
})
|
|
|
|
require.Equal(t, &cnr, o.ContainerID())
|
|
require.Equal(t, &own, o.OwnerID())
|
|
}
|