forked from TrueCloudLab/frostfs-api-go
[#295] pkg: Remove usage of deprecated elements
Remove usage of deprecated of `container.ID` and `token.SessionToken` code elements. Replace using of custom message generators with the ones provided by packages. Replace string comparison with `Equal` method call. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
89be8d3f5a
commit
65080c8b69
22 changed files with 97 additions and 209 deletions
|
@ -6,26 +6,25 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/acl/eacl"
|
||||
"github.com/nspcc-dev/neofs-api-go/pkg/container"
|
||||
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"
|
||||
)
|
||||
|
||||
func TestTable(t *testing.T) {
|
||||
var (
|
||||
v pkg.Version
|
||||
cid container.ID
|
||||
v pkg.Version
|
||||
)
|
||||
|
||||
sha := sha256.Sum256([]byte("container id"))
|
||||
cid.SetSHA256(sha)
|
||||
id := cidtest.GenerateWithChecksum(sha)
|
||||
|
||||
v.SetMajor(3)
|
||||
v.SetMinor(2)
|
||||
|
||||
table := eacl.NewTable()
|
||||
table.SetVersion(v)
|
||||
table.SetCID(&cid)
|
||||
table.SetCID(id)
|
||||
table.AddRecord(eacl.CreateRecord(eacl.ActionAllow, eacl.OperationPut))
|
||||
|
||||
v2 := table.ToV2()
|
||||
|
@ -43,11 +42,10 @@ func TestTable(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("create table", func(t *testing.T) {
|
||||
var cid = new(container.ID)
|
||||
cid.SetSHA256(sha256.Sum256([]byte("container id")))
|
||||
id := cidtest.Generate()
|
||||
|
||||
table := eacl.CreateTable(*cid)
|
||||
require.Equal(t, cid, table.CID())
|
||||
table := eacl.CreateTable(*id)
|
||||
require.Equal(t, id, table.CID())
|
||||
require.Equal(t, *pkg.SDKVersion(), table.Version())
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue