forked from TrueCloudLab/frostfs-api-go
[#265] pkg/reputation: Implement GlobalTrust type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
05a351d344
commit
771f395d9d
3 changed files with 242 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue