github.com/cosmos/cosmos-sdk@v0.50.10/x/staking/testutil/validator.go (about) 1 package testutil 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/require" 7 8 cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" 9 sdk "github.com/cosmos/cosmos-sdk/types" 10 "github.com/cosmos/cosmos-sdk/x/staking/types" 11 ) 12 13 // NewValidator is a testing helper method to create validators in tests 14 func NewValidator(tb testing.TB, operator sdk.ValAddress, pubKey cryptotypes.PubKey) types.Validator { 15 tb.Helper() 16 v, err := types.NewValidator(operator.String(), pubKey, types.Description{}) 17 require.NoError(tb, err) 18 return v 19 }