forked from TrueCloudLab/frostfs-api-go
[#293] pkg/eacl: Implement and use generator of Table
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f406463c34
commit
72adf5f972
2 changed files with 14 additions and 4 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||
eacltest "github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl/test"
|
||||
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||
sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
@ -65,10 +66,7 @@ func TestTable_AddRecord(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestRecordEncoding(t *testing.T) {
|
||||
tab := eacl.NewTable()
|
||||
tab.AddRecord(
|
||||
eacl.CreateRecord(eacl.ActionDeny, eacl.OperationHead),
|
||||
)
|
||||
tab := eacltest.Table()
|
||||
|
||||
t.Run("binary", func(t *testing.T) {
|
||||
data, err := tab.Marshal()
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
|
||||
ownertest "github.com/nspcc-dev/neofs-api-go/pkg/owner/test"
|
||||
sessiontest "github.com/nspcc-dev/neofs-api-go/pkg/session/test"
|
||||
)
|
||||
|
||||
// Target returns random eacl.Target.
|
||||
|
@ -31,3 +32,14 @@ func Record() *eacl.Record {
|
|||
|
||||
return x
|
||||
}
|
||||
|
||||
func Table() *eacl.Table {
|
||||
x := eacl.NewTable()
|
||||
|
||||
x.SetCID(cidtest.Generate())
|
||||
x.SetSessionToken(sessiontest.Generate())
|
||||
x.AddRecord(Record())
|
||||
x.AddRecord(Record())
|
||||
|
||||
return x
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue