testutil

package
v0.48.86 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

Package testutil is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var AppConfig = appconfig.Compose(&appv1alpha1.Config{
	Modules: []*appv1alpha1.ModuleConfig{
		{
			Name: "runtime",
			Config: appconfig.WrapAny(&runtimev1alpha1.Module{
				AppName: "DistrApp",
				BeginBlockers: []string{
					minttypes.ModuleName,
					distrtypes.ModuleName,
					stakingtypes.ModuleName,
					genutiltypes.ModuleName,
				},
				EndBlockers: []string{
					stakingtypes.ModuleName,
					genutiltypes.ModuleName,
				},
				InitGenesis: []string{
					authtypes.ModuleName,
					banktypes.ModuleName,
					distrtypes.ModuleName,
					stakingtypes.ModuleName,
					minttypes.ModuleName,
					genutiltypes.ModuleName,
					paramstypes.ModuleName,
					consensustypes.ModuleName,
				},
			}),
		},
		{
			Name: authtypes.ModuleName,
			Config: appconfig.WrapAny(&authmodulev1.Module{
				Bech32Prefix: "cosmos",
				ModuleAccountPermissions: []*authmodulev1.ModuleAccountPermission{
					{Account: authtypes.FeeCollectorName},
					{Account: distrtypes.ModuleName},
					{Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}},
					{Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
					{Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}},
				},
			}),
		},
		{
			Name:   banktypes.ModuleName,
			Config: appconfig.WrapAny(&bankmodulev1.Module{}),
		},
		{
			Name:   stakingtypes.ModuleName,
			Config: appconfig.WrapAny(&stakingmodulev1.Module{}),
		},
		{
			Name:   paramstypes.ModuleName,
			Config: appconfig.WrapAny(&paramsmodulev1.Module{}),
		},
		{
			Name:   consensustypes.ModuleName,
			Config: appconfig.WrapAny(&consensusmodulev1.Module{}),
		},
		{
			Name:   "tx",
			Config: appconfig.WrapAny(&txconfigv1.Config{}),
		},
		{
			Name:   genutiltypes.ModuleName,
			Config: appconfig.WrapAny(&genutilmodulev1.Module{}),
		},
		{
			Name:   distrtypes.ModuleName,
			Config: appconfig.WrapAny(&distrmodulev1.Module{}),
		},
		{
			Name:   minttypes.ModuleName,
			Config: appconfig.WrapAny(&mintmodulev1.Module{}),
		},
	},
})

Functions

func CallCreateValidatorHooks

func CallCreateValidatorHooks(ctx sdk.Context, k keeper.Keeper, addr sdk.AccAddress, valAddr sdk.ValAddress) error

func CreateValidator

func CreateValidator(pk cryptotypes.PubKey, stake math.Int) (stakingtypes.Validator, error)

func Delegate

func Delegate(
	ctx sdk.Context,
	distrKeeper keeper.Keeper,
	delegator sdk.AccAddress,
	validator *stakingtypes.Validator,
	amount math.Int,
	delegation *stakingtypes.Delegation,
) (
	newShares sdk.Dec,
	updatedDel stakingtypes.Delegation,
	err error,
)

Delegate imitate what x/staking Delegate does. It should be used for testing only. If a delegation is passed we are simulating an update to a previous delegation, if it's nil then we simulate a new delegation.

func SlashValidator

func SlashValidator(
	ctx sdk.Context,
	consAddr sdk.ConsAddress,
	infractionHeight int64,
	power int64,
	slashFactor sdk.Dec,
	validator *stakingtypes.Validator,
	distrKeeper *keeper.Keeper,
) math.Int

SlashValidator copies what x/staking Slash does. It should be used for testing only. And it must be updated whenever the original function is updated. The passed validator will get its tokens updated.

Types

type MockAccountKeeper

type MockAccountKeeper struct {
	// contains filtered or unexported fields
}

MockAccountKeeper is a mock of AccountKeeper interface.

func NewMockAccountKeeper

func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper

NewMockAccountKeeper creates a new mock instance.

func (*MockAccountKeeper) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockAccountKeeper) GetAccount

func (m *MockAccountKeeper) GetAccount(ctx types.Context, addr types.AccAddress) types.AccountI

GetAccount mocks base method.

func (*MockAccountKeeper) GetModuleAccount

func (m *MockAccountKeeper) GetModuleAccount(ctx types.Context, name string) types.ModuleAccountI

GetModuleAccount mocks base method.

func (*MockAccountKeeper) GetModuleAddress

func (m *MockAccountKeeper) GetModuleAddress(name string) types.AccAddress

GetModuleAddress mocks base method.

func (*MockAccountKeeper) SetModuleAccount

func (m *MockAccountKeeper) SetModuleAccount(arg0 types.Context, arg1 types.ModuleAccountI)

SetModuleAccount mocks base method.

type MockAccountKeeperMockRecorder

type MockAccountKeeperMockRecorder struct {
	// contains filtered or unexported fields
}

MockAccountKeeperMockRecorder is the mock recorder for MockAccountKeeper.

func (*MockAccountKeeperMockRecorder) GetAccount

func (mr *MockAccountKeeperMockRecorder) GetAccount(ctx, addr interface{}) *gomock.Call

GetAccount indicates an expected call of GetAccount.

func (*MockAccountKeeperMockRecorder) GetModuleAccount

func (mr *MockAccountKeeperMockRecorder) GetModuleAccount(ctx, name interface{}) *gomock.Call

GetModuleAccount indicates an expected call of GetModuleAccount.

func (*MockAccountKeeperMockRecorder) GetModuleAddress

func (mr *MockAccountKeeperMockRecorder) GetModuleAddress(name interface{}) *gomock.Call

GetModuleAddress indicates an expected call of GetModuleAddress.

func (*MockAccountKeeperMockRecorder) SetModuleAccount

func (mr *MockAccountKeeperMockRecorder) SetModuleAccount(arg0, arg1 interface{}) *gomock.Call

SetModuleAccount indicates an expected call of SetModuleAccount.

type MockBankKeeper

type MockBankKeeper struct {
	// contains filtered or unexported fields
}

MockBankKeeper is a mock of BankKeeper interface.

func NewMockBankKeeper

func NewMockBankKeeper(ctrl *gomock.Controller) *MockBankKeeper

NewMockBankKeeper creates a new mock instance.

func (*MockBankKeeper) BlockedAddr

func (m *MockBankKeeper) BlockedAddr(addr types.AccAddress) bool

BlockedAddr mocks base method.

func (*MockBankKeeper) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockBankKeeper) GetAllBalances

func (m *MockBankKeeper) GetAllBalances(ctx types.Context, addr types.AccAddress) types.Coins

GetAllBalances mocks base method.

func (*MockBankKeeper) SendCoinsFromAccountToModule

func (m *MockBankKeeper) SendCoinsFromAccountToModule(ctx types.Context, senderAddr types.AccAddress, recipientModule string, amt types.Coins) error

SendCoinsFromAccountToModule mocks base method.

func (*MockBankKeeper) SendCoinsFromModuleToAccount

func (m *MockBankKeeper) SendCoinsFromModuleToAccount(ctx types.Context, senderModule string, recipientAddr types.AccAddress, amt types.Coins) error

SendCoinsFromModuleToAccount mocks base method.

func (*MockBankKeeper) SendCoinsFromModuleToModule

func (m *MockBankKeeper) SendCoinsFromModuleToModule(ctx types.Context, senderModule, recipientModule string, amt types.Coins) error

SendCoinsFromModuleToModule mocks base method.

func (*MockBankKeeper) SpendableCoins

func (m *MockBankKeeper) SpendableCoins(ctx types.Context, addr types.AccAddress) types.Coins

SpendableCoins mocks base method.

type MockBankKeeperMockRecorder

type MockBankKeeperMockRecorder struct {
	// contains filtered or unexported fields
}

MockBankKeeperMockRecorder is the mock recorder for MockBankKeeper.

func (*MockBankKeeperMockRecorder) BlockedAddr

func (mr *MockBankKeeperMockRecorder) BlockedAddr(addr interface{}) *gomock.Call

BlockedAddr indicates an expected call of BlockedAddr.

func (*MockBankKeeperMockRecorder) GetAllBalances

func (mr *MockBankKeeperMockRecorder) GetAllBalances(ctx, addr interface{}) *gomock.Call

GetAllBalances indicates an expected call of GetAllBalances.

func (*MockBankKeeperMockRecorder) SendCoinsFromAccountToModule

func (mr *MockBankKeeperMockRecorder) SendCoinsFromAccountToModule(ctx, senderAddr, recipientModule, amt interface{}) *gomock.Call

SendCoinsFromAccountToModule indicates an expected call of SendCoinsFromAccountToModule.

func (*MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount

func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToAccount(ctx, senderModule, recipientAddr, amt interface{}) *gomock.Call

SendCoinsFromModuleToAccount indicates an expected call of SendCoinsFromModuleToAccount.

func (*MockBankKeeperMockRecorder) SendCoinsFromModuleToModule

func (mr *MockBankKeeperMockRecorder) SendCoinsFromModuleToModule(ctx, senderModule, recipientModule, amt interface{}) *gomock.Call

SendCoinsFromModuleToModule indicates an expected call of SendCoinsFromModuleToModule.

func (*MockBankKeeperMockRecorder) SpendableCoins

func (mr *MockBankKeeperMockRecorder) SpendableCoins(ctx, addr interface{}) *gomock.Call

SpendableCoins indicates an expected call of SpendableCoins.

type MockStakingHooks

type MockStakingHooks struct {
	// contains filtered or unexported fields
}

MockStakingHooks is a mock of StakingHooks interface.

func NewMockStakingHooks

func NewMockStakingHooks(ctrl *gomock.Controller) *MockStakingHooks

NewMockStakingHooks creates a new mock instance.

func (*MockStakingHooks) AfterDelegationModified

func (m *MockStakingHooks) AfterDelegationModified(ctx types.Context, delAddr types.AccAddress, valAddr types.ValAddress)

AfterDelegationModified mocks base method.

func (*MockStakingHooks) AfterValidatorCreated

func (m *MockStakingHooks) AfterValidatorCreated(ctx types.Context, valAddr types.ValAddress)

AfterValidatorCreated mocks base method.

func (*MockStakingHooks) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

type MockStakingHooksMockRecorder

type MockStakingHooksMockRecorder struct {
	// contains filtered or unexported fields
}

MockStakingHooksMockRecorder is the mock recorder for MockStakingHooks.

func (*MockStakingHooksMockRecorder) AfterDelegationModified

func (mr *MockStakingHooksMockRecorder) AfterDelegationModified(ctx, delAddr, valAddr interface{}) *gomock.Call

AfterDelegationModified indicates an expected call of AfterDelegationModified.

func (*MockStakingHooksMockRecorder) AfterValidatorCreated

func (mr *MockStakingHooksMockRecorder) AfterValidatorCreated(ctx, valAddr interface{}) *gomock.Call

AfterValidatorCreated indicates an expected call of AfterValidatorCreated.

type MockStakingKeeper

type MockStakingKeeper struct {
	// contains filtered or unexported fields
}

MockStakingKeeper is a mock of StakingKeeper interface.

func NewMockStakingKeeper

func NewMockStakingKeeper(ctrl *gomock.Controller) *MockStakingKeeper

NewMockStakingKeeper creates a new mock instance.

func (*MockStakingKeeper) Delegation

Delegation mocks base method.

func (*MockStakingKeeper) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStakingKeeper) GetAllDelegatorDelegations

func (m *MockStakingKeeper) GetAllDelegatorDelegations(ctx types.Context, delegator types.AccAddress) []types0.Delegation

GetAllDelegatorDelegations mocks base method.

func (*MockStakingKeeper) GetAllSDKDelegations

func (m *MockStakingKeeper) GetAllSDKDelegations(ctx types.Context) []types0.Delegation

GetAllSDKDelegations mocks base method.

func (*MockStakingKeeper) GetAllValidators

func (m *MockStakingKeeper) GetAllValidators(ctx types.Context) []types0.Validator

GetAllValidators mocks base method.

func (*MockStakingKeeper) IterateDelegations

func (m *MockStakingKeeper) IterateDelegations(ctx types.Context, delegator types.AccAddress, fn func(int64, types0.DelegationI) bool)

IterateDelegations mocks base method.

func (*MockStakingKeeper) IterateValidators

func (m *MockStakingKeeper) IterateValidators(arg0 types.Context, arg1 func(int64, types0.ValidatorI) bool)

IterateValidators mocks base method.

func (*MockStakingKeeper) Validator

func (m *MockStakingKeeper) Validator(arg0 types.Context, arg1 types.ValAddress) types0.ValidatorI

Validator mocks base method.

func (*MockStakingKeeper) ValidatorByConsAddr

func (m *MockStakingKeeper) ValidatorByConsAddr(arg0 types.Context, arg1 types.ConsAddress) types0.ValidatorI

ValidatorByConsAddr mocks base method.

type MockStakingKeeperMockRecorder

type MockStakingKeeperMockRecorder struct {
	// contains filtered or unexported fields
}

MockStakingKeeperMockRecorder is the mock recorder for MockStakingKeeper.

func (*MockStakingKeeperMockRecorder) Delegation

func (mr *MockStakingKeeperMockRecorder) Delegation(arg0, arg1, arg2 interface{}) *gomock.Call

Delegation indicates an expected call of Delegation.

func (*MockStakingKeeperMockRecorder) GetAllDelegatorDelegations

func (mr *MockStakingKeeperMockRecorder) GetAllDelegatorDelegations(ctx, delegator interface{}) *gomock.Call

GetAllDelegatorDelegations indicates an expected call of GetAllDelegatorDelegations.

func (*MockStakingKeeperMockRecorder) GetAllSDKDelegations

func (mr *MockStakingKeeperMockRecorder) GetAllSDKDelegations(ctx interface{}) *gomock.Call

GetAllSDKDelegations indicates an expected call of GetAllSDKDelegations.

func (*MockStakingKeeperMockRecorder) GetAllValidators

func (mr *MockStakingKeeperMockRecorder) GetAllValidators(ctx interface{}) *gomock.Call

GetAllValidators indicates an expected call of GetAllValidators.

func (*MockStakingKeeperMockRecorder) IterateDelegations

func (mr *MockStakingKeeperMockRecorder) IterateDelegations(ctx, delegator, fn interface{}) *gomock.Call

IterateDelegations indicates an expected call of IterateDelegations.

func (*MockStakingKeeperMockRecorder) IterateValidators

func (mr *MockStakingKeeperMockRecorder) IterateValidators(arg0, arg1 interface{}) *gomock.Call

IterateValidators indicates an expected call of IterateValidators.

func (*MockStakingKeeperMockRecorder) Validator

func (mr *MockStakingKeeperMockRecorder) Validator(arg0, arg1 interface{}) *gomock.Call

Validator indicates an expected call of Validator.

func (*MockStakingKeeperMockRecorder) ValidatorByConsAddr

func (mr *MockStakingKeeperMockRecorder) ValidatorByConsAddr(arg0, arg1 interface{}) *gomock.Call

ValidatorByConsAddr indicates an expected call of ValidatorByConsAddr.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL