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 RewarderMock

type RewarderMock struct {
	// GetPoolFunc mocks the GetPool method.
	GetPoolFunc func(ctx sdk.Context, name string) reward.RewardPool
	// contains filtered or unexported fields
}

RewarderMock is a mock implementation of types.Rewarder.

func TestSomethingThatUsesRewarder(t *testing.T) {

	// make and configure a mocked types.Rewarder
	mockedRewarder := &RewarderMock{
		GetPoolFunc: func(ctx sdk.Context, name string) reward.RewardPool {
			panic("mock out the GetPool method")
		},
	}

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

}

func (*RewarderMock) GetPool

func (mock *RewarderMock) GetPool(ctx sdk.Context, name string) reward.RewardPool

GetPool calls GetPoolFunc.

func (*RewarderMock) GetPoolCalls

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

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

len(mockedRewarder.GetPoolCalls())

type SnapshotterMock

type SnapshotterMock struct {
	// GetOperatorFunc mocks the GetOperator method.
	GetOperatorFunc func(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress
	// contains filtered or unexported fields
}

SnapshotterMock is a mock implementation of types.Snapshotter.

func TestSomethingThatUsesSnapshotter(t *testing.T) {

	// make and configure a mocked types.Snapshotter
	mockedSnapshotter := &SnapshotterMock{
		GetOperatorFunc: func(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress {
			panic("mock out the GetOperator method")
		},
	}

	// use mockedSnapshotter in code that requires types.Snapshotter
	// and then make assertions.

}

func (*SnapshotterMock) GetOperator added in v0.17.0

func (mock *SnapshotterMock) GetOperator(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress

GetOperator calls GetOperatorFunc.

func (*SnapshotterMock) GetOperatorCalls added in v0.17.0

func (mock *SnapshotterMock) GetOperatorCalls() []struct {
	Ctx   sdk.Context
	Proxy sdk.AccAddress
}

GetOperatorCalls gets all the calls that were made to GetOperator. Check the length with:

len(mockedSnapshotter.GetOperatorCalls())

type StakingKeeperMock

type StakingKeeperMock struct {
	// GetLastTotalPowerFunc mocks the GetLastTotalPower method.
	GetLastTotalPowerFunc func(context sdk.Context) sdk.Int

	// PowerReductionFunc mocks the PowerReduction method.
	PowerReductionFunc func(context sdk.Context) sdk.Int

	// ValidatorFunc mocks the Validator method.
	ValidatorFunc func(ctx sdk.Context, addr sdk.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{
		GetLastTotalPowerFunc: func(context sdk.Context) sdk.Int {
			panic("mock out the GetLastTotalPower method")
		},
		PowerReductionFunc: func(context sdk.Context) sdk.Int {
			panic("mock out the PowerReduction method")
		},
		ValidatorFunc: func(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI {
			panic("mock out the Validator method")
		},
	}

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

}

func (*StakingKeeperMock) GetLastTotalPower

func (mock *StakingKeeperMock) GetLastTotalPower(context sdk.Context) sdk.Int

GetLastTotalPower calls GetLastTotalPowerFunc.

func (*StakingKeeperMock) GetLastTotalPowerCalls

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

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

len(mockedStakingKeeper.GetLastTotalPowerCalls())

func (*StakingKeeperMock) PowerReduction

func (mock *StakingKeeperMock) PowerReduction(context sdk.Context) sdk.Int

PowerReduction calls PowerReductionFunc.

func (*StakingKeeperMock) PowerReductionCalls

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

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

len(mockedStakingKeeper.PowerReductionCalls())

func (*StakingKeeperMock) Validator

func (mock *StakingKeeperMock) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI

Validator calls ValidatorFunc.

func (*StakingKeeperMock) ValidatorCalls

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

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

len(mockedStakingKeeper.ValidatorCalls())

type VoteRouterMock added in v0.18.0

type VoteRouterMock struct {
	// AddHandlerFunc mocks the AddHandler method.
	AddHandlerFunc func(module string, handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler) types.VoteRouter

	// GetHandlerFunc mocks the GetHandler method.
	GetHandlerFunc func(module string) github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler

	// HasHandlerFunc mocks the HasHandler method.
	HasHandlerFunc func(module string) bool

	// SealFunc mocks the Seal method.
	SealFunc func()
	// contains filtered or unexported fields
}

VoteRouterMock is a mock implementation of types.VoteRouter.

func TestSomethingThatUsesVoteRouter(t *testing.T) {

	// make and configure a mocked types.VoteRouter
	mockedVoteRouter := &VoteRouterMock{
		AddHandlerFunc: func(module string, handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler) types.VoteRouter {
			panic("mock out the AddHandler method")
		},
		GetHandlerFunc: func(module string) github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler {
			panic("mock out the GetHandler method")
		},
		HasHandlerFunc: func(module string) bool {
			panic("mock out the HasHandler method")
		},
		SealFunc: func()  {
			panic("mock out the Seal method")
		},
	}

	// use mockedVoteRouter in code that requires types.VoteRouter
	// and then make assertions.

}

func (*VoteRouterMock) AddHandler added in v0.18.0

AddHandler calls AddHandlerFunc.

func (*VoteRouterMock) AddHandlerCalls added in v0.18.0

func (mock *VoteRouterMock) AddHandlerCalls() []struct {
	Module  string
	Handler github_com_axelarnetwork_axelar_core_x_vote_exported.VoteHandler
}

AddHandlerCalls gets all the calls that were made to AddHandler. Check the length with:

len(mockedVoteRouter.AddHandlerCalls())

func (*VoteRouterMock) GetHandler added in v0.18.0

GetHandler calls GetHandlerFunc.

func (*VoteRouterMock) GetHandlerCalls added in v0.18.0

func (mock *VoteRouterMock) GetHandlerCalls() []struct {
	Module string
}

GetHandlerCalls gets all the calls that were made to GetHandler. Check the length with:

len(mockedVoteRouter.GetHandlerCalls())

func (*VoteRouterMock) HasHandler added in v0.18.0

func (mock *VoteRouterMock) HasHandler(module string) bool

HasHandler calls HasHandlerFunc.

func (*VoteRouterMock) HasHandlerCalls added in v0.18.0

func (mock *VoteRouterMock) HasHandlerCalls() []struct {
	Module string
}

HasHandlerCalls gets all the calls that were made to HasHandler. Check the length with:

len(mockedVoteRouter.HasHandlerCalls())

func (*VoteRouterMock) Seal added in v0.18.0

func (mock *VoteRouterMock) Seal()

Seal calls SealFunc.

func (*VoteRouterMock) SealCalls added in v0.18.0

func (mock *VoteRouterMock) SealCalls() []struct {
}

SealCalls gets all the calls that were made to Seal. Check the length with:

len(mockedVoteRouter.SealCalls())

type VoterMock added in v0.18.0

type VoterMock struct {
	// DeletePollFunc mocks the DeletePoll method.
	DeletePollFunc func(ctx sdk.Context, pollID github_com_axelarnetwork_axelar_core_x_vote_exported.PollID)

	// GetParamsFunc mocks the GetParams method.
	GetParamsFunc func(ctx sdk.Context) types.Params

	// GetPollFunc mocks the GetPoll method.
	GetPollFunc func(ctx sdk.Context, id github_com_axelarnetwork_axelar_core_x_vote_exported.PollID) (github_com_axelarnetwork_axelar_core_x_vote_exported.Poll, bool)

	// GetPollQueueFunc mocks the GetPollQueue method.
	GetPollQueueFunc func(ctx sdk.Context) utils.KVQueue

	// GetVoteRouterFunc mocks the GetVoteRouter method.
	GetVoteRouterFunc func() types.VoteRouter

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

VoterMock is a mock implementation of types.Voter.

func TestSomethingThatUsesVoter(t *testing.T) {

	// make and configure a mocked types.Voter
	mockedVoter := &VoterMock{
		DeletePollFunc: func(ctx sdk.Context, pollID github_com_axelarnetwork_axelar_core_x_vote_exported.PollID)  {
			panic("mock out the DeletePoll method")
		},
		GetParamsFunc: func(ctx sdk.Context) types.Params {
			panic("mock out the GetParams method")
		},
		GetPollFunc: func(ctx sdk.Context, id github_com_axelarnetwork_axelar_core_x_vote_exported.PollID) (github_com_axelarnetwork_axelar_core_x_vote_exported.Poll, bool) {
			panic("mock out the GetPoll method")
		},
		GetPollQueueFunc: func(ctx sdk.Context) utils.KVQueue {
			panic("mock out the GetPollQueue method")
		},
		GetVoteRouterFunc: func() types.VoteRouter {
			panic("mock out the GetVoteRouter method")
		},
		LoggerFunc: func(ctx sdk.Context) log.Logger {
			panic("mock out the Logger method")
		},
	}

	// use mockedVoter in code that requires types.Voter
	// and then make assertions.

}

func (*VoterMock) DeletePoll added in v0.21.0

DeletePoll calls DeletePollFunc.

func (*VoterMock) DeletePollCalls added in v0.21.0

func (mock *VoterMock) DeletePollCalls() []struct {
	Ctx    sdk.Context
	PollID github_com_axelarnetwork_axelar_core_x_vote_exported.PollID
}

DeletePollCalls gets all the calls that were made to DeletePoll. Check the length with:

len(mockedVoter.DeletePollCalls())

func (*VoterMock) GetParams added in v0.21.0

func (mock *VoterMock) GetParams(ctx sdk.Context) types.Params

GetParams calls GetParamsFunc.

func (*VoterMock) GetParamsCalls added in v0.21.0

func (mock *VoterMock) GetParamsCalls() []struct {
	Ctx sdk.Context
}

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

len(mockedVoter.GetParamsCalls())

func (*VoterMock) GetPoll added in v0.18.0

GetPoll calls GetPollFunc.

func (*VoterMock) GetPollCalls added in v0.18.0

func (mock *VoterMock) GetPollCalls() []struct {
	Ctx sdk.Context
	ID  github_com_axelarnetwork_axelar_core_x_vote_exported.PollID
}

GetPollCalls gets all the calls that were made to GetPoll. Check the length with:

len(mockedVoter.GetPollCalls())

func (*VoterMock) GetPollQueue added in v0.18.0

func (mock *VoterMock) GetPollQueue(ctx sdk.Context) utils.KVQueue

GetPollQueue calls GetPollQueueFunc.

func (*VoterMock) GetPollQueueCalls added in v0.18.0

func (mock *VoterMock) GetPollQueueCalls() []struct {
	Ctx sdk.Context
}

GetPollQueueCalls gets all the calls that were made to GetPollQueue. Check the length with:

len(mockedVoter.GetPollQueueCalls())

func (*VoterMock) GetVoteRouter added in v0.18.0

func (mock *VoterMock) GetVoteRouter() types.VoteRouter

GetVoteRouter calls GetVoteRouterFunc.

func (*VoterMock) GetVoteRouterCalls added in v0.18.0

func (mock *VoterMock) GetVoteRouterCalls() []struct {
}

GetVoteRouterCalls gets all the calls that were made to GetVoteRouter. Check the length with:

len(mockedVoter.GetVoteRouterCalls())

func (*VoterMock) Logger added in v0.18.0

func (mock *VoterMock) Logger(ctx sdk.Context) log.Logger

Logger calls LoggerFunc.

func (*VoterMock) LoggerCalls added in v0.18.0

func (mock *VoterMock) LoggerCalls() []struct {
	Ctx sdk.Context
}

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

len(mockedVoter.LoggerCalls())

Jump to

Keyboard shortcuts

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