mock

package
v0.36.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 5 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 {
	// SpendableBalanceFunc mocks the SpendableBalance method.
	SpendableBalanceFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, address 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 snapshottypes.BankKeeper.

func TestSomethingThatUsesBankKeeper(t *testing.T) {

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

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

}

func (*BankKeeperMock) SpendableBalance added in v0.34.0

SpendableBalance calls SpendableBalanceFunc.

func (*BankKeeperMock) SpendableBalanceCalls added in v0.34.0

func (mock *BankKeeperMock) SpendableBalanceCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Address github_com_cosmos_cosmos_sdk_types.AccAddress
	Denom   string
}

SpendableBalanceCalls gets all the calls that were made to SpendableBalance. Check the length with:

len(mockedBankKeeper.SpendableBalanceCalls())

type SlasherMock added in v0.21.0

type SlasherMock struct {
	// GetValidatorMissedBlockBitArrayFunc mocks the GetValidatorMissedBlockBitArray method.
	GetValidatorMissedBlockBitArrayFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress, index int64) bool

	// GetValidatorSigningInfoFunc mocks the GetValidatorSigningInfo method.
	GetValidatorSigningInfoFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress) (slashingtypes.ValidatorSigningInfo, bool)

	// SignedBlocksWindowFunc mocks the SignedBlocksWindow method.
	SignedBlocksWindowFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) int64
	// contains filtered or unexported fields
}

SlasherMock is a mock implementation of snapshottypes.Slasher.

func TestSomethingThatUsesSlasher(t *testing.T) {

	// make and configure a mocked snapshottypes.Slasher
	mockedSlasher := &SlasherMock{
		GetValidatorMissedBlockBitArrayFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress, index int64) bool {
			panic("mock out the GetValidatorMissedBlockBitArray method")
		},
		GetValidatorSigningInfoFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress) (slashingtypes.ValidatorSigningInfo, bool) {
			panic("mock out the GetValidatorSigningInfo method")
		},
		SignedBlocksWindowFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) int64 {
			panic("mock out the SignedBlocksWindow method")
		},
	}

	// use mockedSlasher in code that requires snapshottypes.Slasher
	// and then make assertions.

}

func (*SlasherMock) GetValidatorMissedBlockBitArray added in v0.21.0

func (mock *SlasherMock) GetValidatorMissedBlockBitArray(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress, index int64) bool

GetValidatorMissedBlockBitArray calls GetValidatorMissedBlockBitArrayFunc.

func (*SlasherMock) GetValidatorMissedBlockBitArrayCalls added in v0.21.0

func (mock *SlasherMock) GetValidatorMissedBlockBitArrayCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Address github_com_cosmos_cosmos_sdk_types.ConsAddress
	Index   int64
}

GetValidatorMissedBlockBitArrayCalls gets all the calls that were made to GetValidatorMissedBlockBitArray. Check the length with:

len(mockedSlasher.GetValidatorMissedBlockBitArrayCalls())

func (*SlasherMock) GetValidatorSigningInfo added in v0.21.0

GetValidatorSigningInfo calls GetValidatorSigningInfoFunc.

func (*SlasherMock) GetValidatorSigningInfoCalls added in v0.21.0

func (mock *SlasherMock) GetValidatorSigningInfoCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Address github_com_cosmos_cosmos_sdk_types.ConsAddress
}

GetValidatorSigningInfoCalls gets all the calls that were made to GetValidatorSigningInfo. Check the length with:

len(mockedSlasher.GetValidatorSigningInfoCalls())

func (*SlasherMock) SignedBlocksWindow added in v0.21.0

func (mock *SlasherMock) SignedBlocksWindow(ctx github_com_cosmos_cosmos_sdk_types.Context) int64

SignedBlocksWindow calls SignedBlocksWindowFunc.

func (*SlasherMock) SignedBlocksWindowCalls added in v0.21.0

func (mock *SlasherMock) SignedBlocksWindowCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
}

SignedBlocksWindowCalls gets all the calls that were made to SignedBlocksWindow. Check the length with:

len(mockedSlasher.SignedBlocksWindowCalls())

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 snapshottypes.StakingKeeper.

func TestSomethingThatUsesStakingKeeper(t *testing.T) {

	// make and configure a mocked snapshottypes.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 snapshottypes.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