frostfs-api-go-pogpp/pkg/test/generate.go
Leonard Lyubich 075003c4f1 [#293] pkg: Implement and use generators of the messages
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2021-06-08 18:59:15 +03:00

51 lines
727 B
Go

package refstest
import (
"crypto/sha256"
"math/rand"
"github.com/nspcc-dev/neofs-api-go/pkg"
)
// Checksum returns random pkg.Checksum.
func Checksum() *pkg.Checksum {
var cs [sha256.Size]byte
rand.Read(cs[:])
x := pkg.NewChecksum()
x.SetSHA256(cs)
return x
}
// Signature returns random pkg.Signature.
func Signature() *pkg.Signature {
x := pkg.NewSignature()
x.SetKey([]byte("key"))
x.SetSign([]byte("sign"))
return x
}
// Version returns random pkg.Version.
func Version() *pkg.Version {
x := pkg.NewVersion()
x.SetMajor(2)
x.SetMinor(1)
return x
}
// XHeader returns random pkg.XHeader.
func XHeader() *pkg.XHeader {
x := pkg.NewXHeader()
x.SetKey("key")
x.SetValue("value")
return x
}