forked from TrueCloudLab/frostfs-sdk-go
[#238] session: Add container.IssuedBy
method
Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
539ac9915e
commit
12ea1e8d74
2 changed files with 38 additions and 0 deletions
|
@ -11,6 +11,7 @@ import (
|
|||
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/session"
|
||||
sessiontest "github.com/nspcc-dev/neofs-sdk-go/session/test"
|
||||
"github.com/nspcc-dev/neofs-sdk-go/user"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
|
@ -285,3 +286,18 @@ func TestContainerSignature(t *testing.T) {
|
|||
require.True(t, x.VerifySignature())
|
||||
}
|
||||
}
|
||||
|
||||
func TestContainer_IssuedBy(t *testing.T) {
|
||||
var (
|
||||
token session.Container
|
||||
issuer user.ID
|
||||
signer = randSigner()
|
||||
)
|
||||
|
||||
user.IDFromKey(&issuer, signer.PublicKey)
|
||||
|
||||
require.False(t, token.IssuedBy(issuer))
|
||||
|
||||
require.NoError(t, token.Sign(signer))
|
||||
require.True(t, token.IssuedBy(issuer))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue