forked from TrueCloudLab/frostfs-sdk-go
[#139] object: Implement function to init object creation
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>
This commit is contained in:
parent
1c161956c8
commit
df5c69eea5
2 changed files with 48 additions and 3 deletions
24
object/object_test.go
Normal file
24
object/object_test.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
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())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue