[#265] pkg/reputation: Implement GlobalTrust type

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-04-02 12:57:53 +03:00 committed by Leonard Lyubich
parent 05a351d344
commit 771f395d9d
3 changed files with 242 additions and 0 deletions

View file

@ -1,9 +1,12 @@
package reputationtest
import (
"testing"
"github.com/nspcc-dev/neofs-api-go/pkg/reputation"
crypto "github.com/nspcc-dev/neofs-crypto"
"github.com/nspcc-dev/neofs-crypto/test"
"github.com/stretchr/testify/require"
)
func GeneratePeerID() *reputation.PeerID {
@ -24,3 +27,19 @@ func GenerateTrust() *reputation.Trust {
return v
}
func GenerateGlobalTrust() *reputation.GlobalTrust {
v := reputation.NewGlobalTrust()
v.SetManager(GeneratePeerID())
v.SetTrust(GenerateTrust())
return v
}
func GenerateSignedGlobalTrust(t testing.TB) *reputation.GlobalTrust {
gt := GenerateGlobalTrust()
require.NoError(t, gt.Sign(test.DecodeKey(0)))
return gt
}