[#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:
Leonard Lyubich 2021-05-31 15:09:04 +03:00 committed by Leonard Lyubich
parent 89be8d3f5a
commit 65080c8b69
22 changed files with 97 additions and 209 deletions

View file

@ -4,19 +4,18 @@ import (
"strings"
"testing"
"github.com/nspcc-dev/neofs-api-go/pkg/container"
cidtest "github.com/nspcc-dev/neofs-api-go/pkg/container/id/test"
"github.com/stretchr/testify/require"
)
func TestAddress_SetContainerID(t *testing.T) {
a := NewAddress()
cid := container.NewID()
cid.SetSHA256(randSHA256Checksum(t))
id := cidtest.Generate()
a.SetContainerID(cid)
a.SetContainerID(id)
require.Equal(t, cid, a.ContainerID())
require.Equal(t, id, a.ContainerID())
}
func TestAddress_SetObjectID(t *testing.T) {
@ -30,8 +29,7 @@ func TestAddress_SetObjectID(t *testing.T) {
}
func TestAddress_Parse(t *testing.T) {
cid := container.NewID()
cid.SetSHA256(randSHA256Checksum(t))
cid := cidtest.Generate()
oid := NewID()
oid.SetSHA256(randSHA256Checksum(t))
@ -64,7 +62,7 @@ func TestAddress_Parse(t *testing.T) {
func TestAddressEncoding(t *testing.T) {
a := NewAddress()
a.SetObjectID(randID(t))
a.SetContainerID(randCID(t))
a.SetContainerID(cidtest.Generate())
t.Run("binary", func(t *testing.T) {
data, err := a.Marshal()