From f406463c344118871162d322d73d3c02ddc486a6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 8 Jun 2021 11:22:58 +0300 Subject: [PATCH] [#293] pkg/eacl: Implement generator of Record Signed-off-by: Leonard Lyubich --- pkg/acl/eacl/test/generate.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkg/acl/eacl/test/generate.go b/pkg/acl/eacl/test/generate.go index 25697e9..1f5fcbd 100644 --- a/pkg/acl/eacl/test/generate.go +++ b/pkg/acl/eacl/test/generate.go @@ -2,6 +2,8 @@ package eacltest 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" ) // Target returns random eacl.Target. @@ -16,3 +18,16 @@ func Target() *eacl.Target { return x } + +// Record returns random eacl.Record. +func Record() *eacl.Record { + x := eacl.NewRecord() + + x.SetAction(eacl.ActionAllow) + x.SetOperation(eacl.OperationRangeHash) + x.SetTargets(Target(), Target()) + x.AddObjectContainerIDFilter(eacl.MatchStringEqual, cidtest.Generate()) + x.AddObjectOwnerIDFilter(eacl.MatchStringNotEqual, ownertest.Generate()) + + return x +}