[#401] test: Randomize value for oneof field

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-05-30 21:13:35 +03:00 committed by LeL
parent 0b8e4e4753
commit d35e935a9d
3 changed files with 49 additions and 5 deletions

View file

@ -2,6 +2,7 @@ package sessiontest
import (
acltest "github.com/nspcc-dev/neofs-api-go/v2/acl/test"
"github.com/nspcc-dev/neofs-api-go/v2/internal"
refstest "github.com/nspcc-dev/neofs-api-go/v2/refs/test"
"github.com/nspcc-dev/neofs-api-go/v2/session"
statustest "github.com/nspcc-dev/neofs-api-go/v2/status/test"
@ -165,7 +166,13 @@ func GenerateSessionTokenBody(empty bool) *session.TokenBody {
m.SetSessionKey([]byte{2})
m.SetOwnerID(refstest.GenerateOwnerID(false))
m.SetLifetime(GenerateTokenLifetime(false))
m.SetContext(GenerateObjectSessionContext(false))
switch internal.RandUint32(2) {
case 0:
m.SetContext(GenerateObjectSessionContext(false))
case 1:
m.SetContext(GenerateContainerSessionContext(false))
}
}
return m