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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BankerMock

type BankerMock struct {
	// MintCoinsFunc mocks the MintCoins method.
	MintCoinsFunc func(ctx cosmossdktypes.Context, name string, amt cosmossdktypes.Coins) error

	// SendCoinsFromModuleToAccountFunc mocks the SendCoinsFromModuleToAccount method.
	SendCoinsFromModuleToAccountFunc func(ctx cosmossdktypes.Context, senderModule string, recipientAddr cosmossdktypes.AccAddress, amt cosmossdktypes.Coins) error

	// SendCoinsFromModuleToModuleFunc mocks the SendCoinsFromModuleToModule method.
	SendCoinsFromModuleToModuleFunc func(ctx cosmossdktypes.Context, senderModule string, recipientModule string, amt cosmossdktypes.Coins) error
	// contains filtered or unexported fields
}

BankerMock is a mock implementation of rewardtypes.Banker.

func TestSomethingThatUsesBanker(t *testing.T) {

	// make and configure a mocked rewardtypes.Banker
	mockedBanker := &BankerMock{
		MintCoinsFunc: func(ctx cosmossdktypes.Context, name string, amt cosmossdktypes.Coins) error {
			panic("mock out the MintCoins method")
		},
		SendCoinsFromModuleToAccountFunc: func(ctx cosmossdktypes.Context, senderModule string, recipientAddr cosmossdktypes.AccAddress, amt cosmossdktypes.Coins) error {
			panic("mock out the SendCoinsFromModuleToAccount method")
		},
		SendCoinsFromModuleToModuleFunc: func(ctx cosmossdktypes.Context, senderModule string, recipientModule string, amt cosmossdktypes.Coins) error {
			panic("mock out the SendCoinsFromModuleToModule method")
		},
	}

	// use mockedBanker in code that requires rewardtypes.Banker
	// and then make assertions.

}

func (*BankerMock) MintCoins

func (mock *BankerMock) MintCoins(ctx cosmossdktypes.Context, name string, amt cosmossdktypes.Coins) error

MintCoins calls MintCoinsFunc.

func (*BankerMock) MintCoinsCalls

func (mock *BankerMock) MintCoinsCalls() []struct {
	Ctx  cosmossdktypes.Context
	Name string
	Amt  cosmossdktypes.Coins
}

MintCoinsCalls gets all the calls that were made to MintCoins. Check the length with:

len(mockedBanker.MintCoinsCalls())

func (*BankerMock) SendCoinsFromModuleToAccount added in v0.9.0

func (mock *BankerMock) SendCoinsFromModuleToAccount(ctx cosmossdktypes.Context, senderModule string, recipientAddr cosmossdktypes.AccAddress, amt cosmossdktypes.Coins) error

SendCoinsFromModuleToAccount calls SendCoinsFromModuleToAccountFunc.

func (*BankerMock) SendCoinsFromModuleToAccountCalls added in v0.9.0

func (mock *BankerMock) SendCoinsFromModuleToAccountCalls() []struct {
	Ctx           cosmossdktypes.Context
	SenderModule  string
	RecipientAddr cosmossdktypes.AccAddress
	Amt           cosmossdktypes.Coins
}

SendCoinsFromModuleToAccountCalls gets all the calls that were made to SendCoinsFromModuleToAccount. Check the length with:

len(mockedBanker.SendCoinsFromModuleToAccountCalls())

func (*BankerMock) SendCoinsFromModuleToModule

func (mock *BankerMock) SendCoinsFromModuleToModule(ctx cosmossdktypes.Context, senderModule string, recipientModule string, amt cosmossdktypes.Coins) error

SendCoinsFromModuleToModule calls SendCoinsFromModuleToModuleFunc.

func (*BankerMock) SendCoinsFromModuleToModuleCalls

func (mock *BankerMock) SendCoinsFromModuleToModuleCalls() []struct {
	Ctx             cosmossdktypes.Context
	SenderModule    string
	RecipientModule string
	Amt             cosmossdktypes.Coins
}

SendCoinsFromModuleToModuleCalls gets all the calls that were made to SendCoinsFromModuleToModule. Check the length with:

len(mockedBanker.SendCoinsFromModuleToModuleCalls())

type DistributorMock

type DistributorMock struct {
	// AllocateTokensToValidatorFunc mocks the AllocateTokensToValidator method.
	AllocateTokensToValidatorFunc func(ctx cosmossdktypes.Context, val stakingtypes.ValidatorI, tokens cosmossdktypes.DecCoins)
	// contains filtered or unexported fields
}

DistributorMock is a mock implementation of rewardtypes.Distributor.

func TestSomethingThatUsesDistributor(t *testing.T) {

	// make and configure a mocked rewardtypes.Distributor
	mockedDistributor := &DistributorMock{
		AllocateTokensToValidatorFunc: func(ctx cosmossdktypes.Context, val stakingtypes.ValidatorI, tokens cosmossdktypes.DecCoins)  {
			panic("mock out the AllocateTokensToValidator method")
		},
	}

	// use mockedDistributor in code that requires rewardtypes.Distributor
	// and then make assertions.

}

func (*DistributorMock) AllocateTokensToValidator

func (mock *DistributorMock) AllocateTokensToValidator(ctx cosmossdktypes.Context, val stakingtypes.ValidatorI, tokens cosmossdktypes.DecCoins)

AllocateTokensToValidator calls AllocateTokensToValidatorFunc.

func (*DistributorMock) AllocateTokensToValidatorCalls

func (mock *DistributorMock) AllocateTokensToValidatorCalls() []struct {
	Ctx    cosmossdktypes.Context
	Val    stakingtypes.ValidatorI
	Tokens cosmossdktypes.DecCoins
}

AllocateTokensToValidatorCalls gets all the calls that were made to AllocateTokensToValidator. Check the length with:

len(mockedDistributor.AllocateTokensToValidatorCalls())

type MinterMock

type MinterMock struct {
	// GetMinterFunc mocks the GetMinter method.
	GetMinterFunc func(ctx cosmossdktypes.Context) minttypes.Minter

	// GetParamsFunc mocks the GetParams method.
	GetParamsFunc func(ctx cosmossdktypes.Context) minttypes.Params

	// StakingTokenSupplyFunc mocks the StakingTokenSupply method.
	StakingTokenSupplyFunc func(ctx cosmossdktypes.Context) cosmossdktypes.Int
	// contains filtered or unexported fields
}

MinterMock is a mock implementation of rewardtypes.Minter.

func TestSomethingThatUsesMinter(t *testing.T) {

	// make and configure a mocked rewardtypes.Minter
	mockedMinter := &MinterMock{
		GetMinterFunc: func(ctx cosmossdktypes.Context) minttypes.Minter {
			panic("mock out the GetMinter method")
		},
		GetParamsFunc: func(ctx cosmossdktypes.Context) minttypes.Params {
			panic("mock out the GetParams method")
		},
		StakingTokenSupplyFunc: func(ctx cosmossdktypes.Context) cosmossdktypes.Int {
			panic("mock out the StakingTokenSupply method")
		},
	}

	// use mockedMinter in code that requires rewardtypes.Minter
	// and then make assertions.

}

func (*MinterMock) GetMinter

func (mock *MinterMock) GetMinter(ctx cosmossdktypes.Context) minttypes.Minter

GetMinter calls GetMinterFunc.

func (*MinterMock) GetMinterCalls

func (mock *MinterMock) GetMinterCalls() []struct {
	Ctx cosmossdktypes.Context
}

GetMinterCalls gets all the calls that were made to GetMinter. Check the length with:

len(mockedMinter.GetMinterCalls())

func (*MinterMock) GetParams

func (mock *MinterMock) GetParams(ctx cosmossdktypes.Context) minttypes.Params

GetParams calls GetParamsFunc.

func (*MinterMock) GetParamsCalls

func (mock *MinterMock) GetParamsCalls() []struct {
	Ctx cosmossdktypes.Context
}

GetParamsCalls gets all the calls that were made to GetParams. Check the length with:

len(mockedMinter.GetParamsCalls())

func (*MinterMock) StakingTokenSupply

func (mock *MinterMock) StakingTokenSupply(ctx cosmossdktypes.Context) cosmossdktypes.Int

StakingTokenSupply calls StakingTokenSupplyFunc.

func (*MinterMock) StakingTokenSupplyCalls

func (mock *MinterMock) StakingTokenSupplyCalls() []struct {
	Ctx cosmossdktypes.Context
}

StakingTokenSupplyCalls gets all the calls that were made to StakingTokenSupply. Check the length with:

len(mockedMinter.StakingTokenSupplyCalls())

type NexusMock

type NexusMock struct {
	// GetChainMaintainersFunc mocks the GetChainMaintainers method.
	GetChainMaintainersFunc func(ctx cosmossdktypes.Context, chain nexus.Chain) []cosmossdktypes.ValAddress

	// GetChainsFunc mocks the GetChains method.
	GetChainsFunc func(ctx cosmossdktypes.Context) []nexus.Chain

	// IsChainActivatedFunc mocks the IsChainActivated method.
	IsChainActivatedFunc func(ctx cosmossdktypes.Context, chain nexus.Chain) bool
	// contains filtered or unexported fields
}

NexusMock is a mock implementation of rewardtypes.Nexus.

func TestSomethingThatUsesNexus(t *testing.T) {

	// make and configure a mocked rewardtypes.Nexus
	mockedNexus := &NexusMock{
		GetChainMaintainersFunc: func(ctx cosmossdktypes.Context, chain nexus.Chain) []cosmossdktypes.ValAddress {
			panic("mock out the GetChainMaintainers method")
		},
		GetChainsFunc: func(ctx cosmossdktypes.Context) []nexus.Chain {
			panic("mock out the GetChains method")
		},
		IsChainActivatedFunc: func(ctx cosmossdktypes.Context, chain nexus.Chain) bool {
			panic("mock out the IsChainActivated method")
		},
	}

	// use mockedNexus in code that requires rewardtypes.Nexus
	// and then make assertions.

}

func (*NexusMock) GetChainMaintainers

func (mock *NexusMock) GetChainMaintainers(ctx cosmossdktypes.Context, chain nexus.Chain) []cosmossdktypes.ValAddress

GetChainMaintainers calls GetChainMaintainersFunc.

func (*NexusMock) GetChainMaintainersCalls

func (mock *NexusMock) GetChainMaintainersCalls() []struct {
	Ctx   cosmossdktypes.Context
	Chain nexus.Chain
}

GetChainMaintainersCalls gets all the calls that were made to GetChainMaintainers. Check the length with:

len(mockedNexus.GetChainMaintainersCalls())

func (*NexusMock) GetChains

func (mock *NexusMock) GetChains(ctx cosmossdktypes.Context) []nexus.Chain

GetChains calls GetChainsFunc.

func (*NexusMock) GetChainsCalls

func (mock *NexusMock) GetChainsCalls() []struct {
	Ctx cosmossdktypes.Context
}

GetChainsCalls gets all the calls that were made to GetChains. Check the length with:

len(mockedNexus.GetChainsCalls())

func (*NexusMock) IsChainActivated added in v0.10.0

func (mock *NexusMock) IsChainActivated(ctx cosmossdktypes.Context, chain nexus.Chain) bool

IsChainActivated calls IsChainActivatedFunc.

func (*NexusMock) IsChainActivatedCalls added in v0.10.0

func (mock *NexusMock) IsChainActivatedCalls() []struct {
	Ctx   cosmossdktypes.Context
	Chain nexus.Chain
}

IsChainActivatedCalls gets all the calls that were made to IsChainActivated. Check the length with:

len(mockedNexus.IsChainActivatedCalls())

type RefunderMock added in v0.9.0

type RefunderMock struct {
	// DeletePendingRefundFunc mocks the DeletePendingRefund method.
	DeletePendingRefundFunc func(ctx cosmossdktypes.Context, req rewardtypes.RefundMsgRequest)

	// GetPendingRefundFunc mocks the GetPendingRefund method.
	GetPendingRefundFunc func(ctx cosmossdktypes.Context, req rewardtypes.RefundMsgRequest) (rewardtypes.Refund, bool)

	// LoggerFunc mocks the Logger method.
	LoggerFunc func(ctx cosmossdktypes.Context) log.Logger
	// contains filtered or unexported fields
}

RefunderMock is a mock implementation of rewardtypes.Refunder.

func TestSomethingThatUsesRefunder(t *testing.T) {

	// make and configure a mocked rewardtypes.Refunder
	mockedRefunder := &RefunderMock{
		DeletePendingRefundFunc: func(ctx cosmossdktypes.Context, req rewardtypes.RefundMsgRequest)  {
			panic("mock out the DeletePendingRefund method")
		},
		GetPendingRefundFunc: func(ctx cosmossdktypes.Context, req rewardtypes.RefundMsgRequest) (rewardtypes.Refund, bool) {
			panic("mock out the GetPendingRefund method")
		},
		LoggerFunc: func(ctx cosmossdktypes.Context) log.Logger {
			panic("mock out the Logger method")
		},
	}

	// use mockedRefunder in code that requires rewardtypes.Refunder
	// and then make assertions.

}

func (*RefunderMock) DeletePendingRefund added in v0.9.0

func (mock *RefunderMock) DeletePendingRefund(ctx cosmossdktypes.Context, req rewardtypes.RefundMsgRequest)

DeletePendingRefund calls DeletePendingRefundFunc.

func (*RefunderMock) DeletePendingRefundCalls added in v0.9.0

func (mock *RefunderMock) DeletePendingRefundCalls() []struct {
	Ctx cosmossdktypes.Context
	Req rewardtypes.RefundMsgRequest
}

DeletePendingRefundCalls gets all the calls that were made to DeletePendingRefund. Check the length with:

len(mockedRefunder.DeletePendingRefundCalls())

func (*RefunderMock) GetPendingRefund added in v0.9.0

GetPendingRefund calls GetPendingRefundFunc.

func (*RefunderMock) GetPendingRefundCalls added in v0.9.0

func (mock *RefunderMock) GetPendingRefundCalls() []struct {
	Ctx cosmossdktypes.Context
	Req rewardtypes.RefundMsgRequest
}

GetPendingRefundCalls gets all the calls that were made to GetPendingRefund. Check the length with:

len(mockedRefunder.GetPendingRefundCalls())

func (*RefunderMock) Logger added in v0.9.0

func (mock *RefunderMock) Logger(ctx cosmossdktypes.Context) log.Logger

Logger calls LoggerFunc.

func (*RefunderMock) LoggerCalls added in v0.9.0

func (mock *RefunderMock) LoggerCalls() []struct {
	Ctx cosmossdktypes.Context
}

LoggerCalls gets all the calls that were made to Logger. Check the length with:

len(mockedRefunder.LoggerCalls())

type RewarderMock

type RewarderMock struct {
	// GetParamsFunc mocks the GetParams method.
	GetParamsFunc func(ctx cosmossdktypes.Context) rewardtypes.Params

	// GetPoolFunc mocks the GetPool method.
	GetPoolFunc func(ctx cosmossdktypes.Context, name string) exported.RewardPool

	// LoggerFunc mocks the Logger method.
	LoggerFunc func(ctx cosmossdktypes.Context) log.Logger
	// contains filtered or unexported fields
}

RewarderMock is a mock implementation of rewardtypes.Rewarder.

func TestSomethingThatUsesRewarder(t *testing.T) {

	// make and configure a mocked rewardtypes.Rewarder
	mockedRewarder := &RewarderMock{
		GetParamsFunc: func(ctx cosmossdktypes.Context) rewardtypes.Params {
			panic("mock out the GetParams method")
		},
		GetPoolFunc: func(ctx cosmossdktypes.Context, name string) exported.RewardPool {
			panic("mock out the GetPool method")
		},
		LoggerFunc: func(ctx cosmossdktypes.Context) log.Logger {
			panic("mock out the Logger method")
		},
	}

	// use mockedRewarder in code that requires rewardtypes.Rewarder
	// and then make assertions.

}

func (*RewarderMock) GetParams

func (mock *RewarderMock) GetParams(ctx cosmossdktypes.Context) rewardtypes.Params

GetParams calls GetParamsFunc.

func (*RewarderMock) GetParamsCalls

func (mock *RewarderMock) GetParamsCalls() []struct {
	Ctx cosmossdktypes.Context
}

GetParamsCalls gets all the calls that were made to GetParams. Check the length with:

len(mockedRewarder.GetParamsCalls())

func (*RewarderMock) GetPool

func (mock *RewarderMock) GetPool(ctx cosmossdktypes.Context, name string) exported.RewardPool

GetPool calls GetPoolFunc.

func (*RewarderMock) GetPoolCalls

func (mock *RewarderMock) GetPoolCalls() []struct {
	Ctx  cosmossdktypes.Context
	Name string
}

GetPoolCalls gets all the calls that were made to GetPool. Check the length with:

len(mockedRewarder.GetPoolCalls())

func (*RewarderMock) Logger

func (mock *RewarderMock) Logger(ctx cosmossdktypes.Context) log.Logger

Logger calls LoggerFunc.

func (*RewarderMock) LoggerCalls

func (mock *RewarderMock) LoggerCalls() []struct {
	Ctx cosmossdktypes.Context
}

LoggerCalls gets all the calls that were made to Logger. Check the length with:

len(mockedRewarder.LoggerCalls())

type SlasherMock added in v0.21.0

type SlasherMock struct {
	// IsTombstonedFunc mocks the IsTombstoned method.
	IsTombstonedFunc func(ctx cosmossdktypes.Context, consAddr cosmossdktypes.ConsAddress) bool
	// contains filtered or unexported fields
}

SlasherMock is a mock implementation of rewardtypes.Slasher.

func TestSomethingThatUsesSlasher(t *testing.T) {

	// make and configure a mocked rewardtypes.Slasher
	mockedSlasher := &SlasherMock{
		IsTombstonedFunc: func(ctx cosmossdktypes.Context, consAddr cosmossdktypes.ConsAddress) bool {
			panic("mock out the IsTombstoned method")
		},
	}

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

}

func (*SlasherMock) IsTombstoned added in v0.21.0

func (mock *SlasherMock) IsTombstoned(ctx cosmossdktypes.Context, consAddr cosmossdktypes.ConsAddress) bool

IsTombstoned calls IsTombstonedFunc.

func (*SlasherMock) IsTombstonedCalls added in v0.21.0

func (mock *SlasherMock) IsTombstonedCalls() []struct {
	Ctx      cosmossdktypes.Context
	ConsAddr cosmossdktypes.ConsAddress
}

IsTombstonedCalls gets all the calls that were made to IsTombstoned. Check the length with:

len(mockedSlasher.IsTombstonedCalls())

type StakerMock

type StakerMock struct {
	// IterateBondedValidatorsByPowerFunc mocks the IterateBondedValidatorsByPower method.
	IterateBondedValidatorsByPowerFunc func(ctx cosmossdktypes.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))

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

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

StakerMock is a mock implementation of rewardtypes.Staker.

func TestSomethingThatUsesStaker(t *testing.T) {

	// make and configure a mocked rewardtypes.Staker
	mockedStaker := &StakerMock{
		IterateBondedValidatorsByPowerFunc: func(ctx cosmossdktypes.Context, fn func(index int64, validator stakingtypes.ValidatorI) (stop bool))  {
			panic("mock out the IterateBondedValidatorsByPower method")
		},
		PowerReductionFunc: func(ctx cosmossdktypes.Context) cosmossdktypes.Int {
			panic("mock out the PowerReduction method")
		},
		ValidatorFunc: func(ctx cosmossdktypes.Context, addr cosmossdktypes.ValAddress) stakingtypes.ValidatorI {
			panic("mock out the Validator method")
		},
	}

	// use mockedStaker in code that requires rewardtypes.Staker
	// and then make assertions.

}

func (*StakerMock) IterateBondedValidatorsByPower

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

IterateBondedValidatorsByPower calls IterateBondedValidatorsByPowerFunc.

func (*StakerMock) IterateBondedValidatorsByPowerCalls

func (mock *StakerMock) IterateBondedValidatorsByPowerCalls() []struct {
	Ctx cosmossdktypes.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(mockedStaker.IterateBondedValidatorsByPowerCalls())

func (*StakerMock) PowerReduction

func (mock *StakerMock) PowerReduction(ctx cosmossdktypes.Context) cosmossdktypes.Int

PowerReduction calls PowerReductionFunc.

func (*StakerMock) PowerReductionCalls

func (mock *StakerMock) PowerReductionCalls() []struct {
	Ctx cosmossdktypes.Context
}

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

len(mockedStaker.PowerReductionCalls())

func (*StakerMock) Validator

Validator calls ValidatorFunc.

func (*StakerMock) ValidatorCalls

func (mock *StakerMock) ValidatorCalls() []struct {
	Ctx  cosmossdktypes.Context
	Addr cosmossdktypes.ValAddress
}

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

len(mockedStaker.ValidatorCalls())

Jump to

Keyboard shortcuts

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