[#59] audit/test: reuse version generator

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-11-08 15:13:59 +03:00 committed by Alex Vanin
parent db784a5758
commit 74a5254819
2 changed files with 19 additions and 2 deletions

View file

@ -5,14 +5,14 @@ import (
cidtest "github.com/nspcc-dev/neofs-sdk-go/container/id/test"
"github.com/nspcc-dev/neofs-sdk-go/object"
objecttest "github.com/nspcc-dev/neofs-sdk-go/object/test"
"github.com/nspcc-dev/neofs-sdk-go/version"
versiontest "github.com/nspcc-dev/neofs-sdk-go/version/test"
)
// Generate returns random audit.Result.
func Generate() *audit.Result {
x := audit.NewResult()
x.SetVersion(version.Current())
x.SetVersion(versiontest.Version())
x.SetContainerID(cidtest.GenerateID())
x.SetPublicKey([]byte("key"))
x.SetComplete(true)

17
version/test/generate.go Normal file
View file

@ -0,0 +1,17 @@
package test
import (
"math/rand"
"github.com/nspcc-dev/neofs-sdk-go/version"
)
// Version returns random version.Version.
func Version() *version.Version {
x := version.New()
x.SetMajor(rand.Uint32())
x.SetMinor(rand.Uint32())
return x
}