mock

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankKeeperMock

type BankKeeperMock struct {
	// GetBalanceFunc mocks the GetBalance method.
	GetBalanceFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.AccAddress, denom string) github_com_cosmos_cosmos_sdk_types.Coin
	// contains filtered or unexported fields
}

BankKeeperMock is a mock implementation of types.BankKeeper.

func TestSomethingThatUsesBankKeeper(t *testing.T) {

	// make and configure a mocked types.BankKeeper
	mockedBankKeeper := &BankKeeperMock{
		GetBalanceFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.AccAddress, denom string) github_com_cosmos_cosmos_sdk_types.Coin {
			panic("mock out the GetBalance method")
		},
	}

	// use mockedBankKeeper in code that requires types.BankKeeper
	// and then make assertions.

}

func (*BankKeeperMock) GetBalance

GetBalance calls GetBalanceFunc.

func (*BankKeeperMock) GetBalanceCalls

GetBalanceCalls gets all the calls that were made to GetBalance. Check the length with:

len(mockedBankKeeper.GetBalanceCalls())

type StakingKeeperMock

type StakingKeeperMock struct {
	// BondDenomFunc mocks the BondDenom method.
	BondDenomFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) string

	// GetLastTotalPowerFunc mocks the GetLastTotalPower method.
	GetLastTotalPowerFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int

	// IterateBondedValidatorsByPowerFunc mocks the IterateBondedValidatorsByPower method.
	IterateBondedValidatorsByPowerFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))

	// PowerReductionFunc mocks the PowerReduction method.
	PowerReductionFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int

	// ValidatorFunc mocks the Validator method.
	ValidatorFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.ValAddress) stakingtypes.ValidatorI
	// contains filtered or unexported fields
}

StakingKeeperMock is a mock implementation of types.StakingKeeper.

func TestSomethingThatUsesStakingKeeper(t *testing.T) {

	// make and configure a mocked types.StakingKeeper
	mockedStakingKeeper := &StakingKeeperMock{
		BondDenomFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) string {
			panic("mock out the BondDenom method")
		},
		GetLastTotalPowerFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
			panic("mock out the GetLastTotalPower method")
		},
		IterateBondedValidatorsByPowerFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))  {
			panic("mock out the IterateBondedValidatorsByPower method")
		},
		PowerReductionFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
			panic("mock out the PowerReduction method")
		},
		ValidatorFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, addr github_com_cosmos_cosmos_sdk_types.ValAddress) stakingtypes.ValidatorI {
			panic("mock out the Validator method")
		},
	}

	// use mockedStakingKeeper in code that requires types.StakingKeeper
	// and then make assertions.

}

func (*StakingKeeperMock) BondDenom

BondDenom calls BondDenomFunc.

func (*StakingKeeperMock) BondDenomCalls

func (mock *StakingKeeperMock) BondDenomCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
}

BondDenomCalls gets all the calls that were made to BondDenom. Check the length with:

len(mockedStakingKeeper.BondDenomCalls())

func (*StakingKeeperMock) GetLastTotalPower

GetLastTotalPower calls GetLastTotalPowerFunc.

func (*StakingKeeperMock) GetLastTotalPowerCalls

func (mock *StakingKeeperMock) GetLastTotalPowerCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
}

GetLastTotalPowerCalls gets all the calls that were made to GetLastTotalPower. Check the length with:

len(mockedStakingKeeper.GetLastTotalPowerCalls())

func (*StakingKeeperMock) IterateBondedValidatorsByPower

func (mock *StakingKeeperMock) IterateBondedValidatorsByPower(ctx github_com_cosmos_cosmos_sdk_types.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))

IterateBondedValidatorsByPower calls IterateBondedValidatorsByPowerFunc.

func (*StakingKeeperMock) IterateBondedValidatorsByPowerCalls

func (mock *StakingKeeperMock) IterateBondedValidatorsByPowerCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
	Fn  func(index int64, validator stakingtypes.ValidatorI) (stop bool)
}

IterateBondedValidatorsByPowerCalls gets all the calls that were made to IterateBondedValidatorsByPower. Check the length with:

len(mockedStakingKeeper.IterateBondedValidatorsByPowerCalls())

func (*StakingKeeperMock) PowerReduction

PowerReduction calls PowerReductionFunc.

func (*StakingKeeperMock) PowerReductionCalls

func (mock *StakingKeeperMock) PowerReductionCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
}

PowerReductionCalls gets all the calls that were made to PowerReduction. Check the length with:

len(mockedStakingKeeper.PowerReductionCalls())

func (*StakingKeeperMock) Validator

Validator calls ValidatorFunc.

func (*StakingKeeperMock) ValidatorCalls

ValidatorCalls gets all the calls that were made to Validator. Check the length with:

len(mockedStakingKeeper.ValidatorCalls())

Jump to

Keyboard shortcuts

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