mock

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2021 License: Apache-2.0 Imports: 7 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 github_com_cosmos_cosmos_sdk_types.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 github_com_cosmos_cosmos_sdk_types.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

GetPool calls GetPoolFunc.

func (*RewarderMock) GetPoolCalls

func (mock *RewarderMock) GetPoolCalls() []struct {
	Ctx  github_com_cosmos_cosmos_sdk_types.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 {
	// GetSnapshotFunc mocks the GetSnapshot method.
	GetSnapshotFunc func(context github_com_cosmos_cosmos_sdk_types.Context, n int64) (snapshot.Snapshot, bool)
	// 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{
		GetSnapshotFunc: func(context github_com_cosmos_cosmos_sdk_types.Context, n int64) (snapshot.Snapshot, bool) {
			panic("mock out the GetSnapshot method")
		},
	}

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

}

func (*SnapshotterMock) GetSnapshot

GetSnapshot calls GetSnapshotFunc.

func (*SnapshotterMock) GetSnapshotCalls

func (mock *SnapshotterMock) GetSnapshotCalls() []struct {
	Context github_com_cosmos_cosmos_sdk_types.Context
	N       int64
}

GetSnapshotCalls gets all the calls that were made to GetSnapshot. Check the length with:

len(mockedSnapshotter.GetSnapshotCalls())

type StakingKeeperMock

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

	// PowerReductionFunc mocks the PowerReduction method.
	PowerReductionFunc func(context 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{
		GetLastTotalPowerFunc: func(context github_com_cosmos_cosmos_sdk_types.Context) github_com_cosmos_cosmos_sdk_types.Int {
			panic("mock out the GetLastTotalPower method")
		},
		PowerReductionFunc: func(context 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) GetLastTotalPower

GetLastTotalPower calls GetLastTotalPowerFunc.

func (*StakingKeeperMock) GetLastTotalPowerCalls

func (mock *StakingKeeperMock) GetLastTotalPowerCalls() []struct {
	Context 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) PowerReduction

PowerReduction calls PowerReductionFunc.

func (*StakingKeeperMock) PowerReductionCalls

func (mock *StakingKeeperMock) PowerReductionCalls() []struct {
	Context 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())

type StoreMock

type StoreMock struct {
	// DeletePollFunc mocks the DeletePoll method.
	DeletePollFunc func()

	// GetPollFunc mocks the GetPoll method.
	GetPollFunc func(key exported.PollKey) exported.Poll

	// GetVoteFunc mocks the GetVote method.
	GetVoteFunc func(hash string) (types.TalliedVote, bool)

	// GetVotesFunc mocks the GetVotes method.
	GetVotesFunc func() []types.TalliedVote

	// HasVotedFunc mocks the HasVoted method.
	HasVotedFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool

	// SetMetadataFunc mocks the SetMetadata method.
	SetMetadataFunc func(metadata exported.PollMetadata)

	// SetVoteFunc mocks the SetVote method.
	SetVoteFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress, vote types.TalliedVote)
	// contains filtered or unexported fields
}

StoreMock is a mock implementation of types.Store.

func TestSomethingThatUsesStore(t *testing.T) {

	// make and configure a mocked types.Store
	mockedStore := &StoreMock{
		DeletePollFunc: func()  {
			panic("mock out the DeletePoll method")
		},
		GetPollFunc: func(key exported.PollKey) exported.Poll {
			panic("mock out the GetPoll method")
		},
		GetVoteFunc: func(hash string) (types.TalliedVote, bool) {
			panic("mock out the GetVote method")
		},
		GetVotesFunc: func() []types.TalliedVote {
			panic("mock out the GetVotes method")
		},
		HasVotedFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
			panic("mock out the HasVoted method")
		},
		SetMetadataFunc: func(metadata exported.PollMetadata)  {
			panic("mock out the SetMetadata method")
		},
		SetVoteFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress, vote types.TalliedVote)  {
			panic("mock out the SetVote method")
		},
	}

	// use mockedStore in code that requires types.Store
	// and then make assertions.

}

func (*StoreMock) DeletePoll

func (mock *StoreMock) DeletePoll()

DeletePoll calls DeletePollFunc.

func (*StoreMock) DeletePollCalls

func (mock *StoreMock) DeletePollCalls() []struct {
}

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

len(mockedStore.DeletePollCalls())

func (*StoreMock) GetPoll

func (mock *StoreMock) GetPoll(key exported.PollKey) exported.Poll

GetPoll calls GetPollFunc.

func (*StoreMock) GetPollCalls

func (mock *StoreMock) GetPollCalls() []struct {
	Key exported.PollKey
}

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

len(mockedStore.GetPollCalls())

func (*StoreMock) GetVote

func (mock *StoreMock) GetVote(hash string) (types.TalliedVote, bool)

GetVote calls GetVoteFunc.

func (*StoreMock) GetVoteCalls

func (mock *StoreMock) GetVoteCalls() []struct {
	Hash string
}

GetVoteCalls gets all the calls that were made to GetVote. Check the length with:

len(mockedStore.GetVoteCalls())

func (*StoreMock) GetVotes

func (mock *StoreMock) GetVotes() []types.TalliedVote

GetVotes calls GetVotesFunc.

func (*StoreMock) GetVotesCalls

func (mock *StoreMock) GetVotesCalls() []struct {
}

GetVotesCalls gets all the calls that were made to GetVotes. Check the length with:

len(mockedStore.GetVotesCalls())

func (*StoreMock) HasVoted

HasVoted calls HasVotedFunc.

func (*StoreMock) HasVotedCalls

func (mock *StoreMock) HasVotedCalls() []struct {
	Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}

HasVotedCalls gets all the calls that were made to HasVoted. Check the length with:

len(mockedStore.HasVotedCalls())

func (*StoreMock) SetMetadata

func (mock *StoreMock) SetMetadata(metadata exported.PollMetadata)

SetMetadata calls SetMetadataFunc.

func (*StoreMock) SetMetadataCalls

func (mock *StoreMock) SetMetadataCalls() []struct {
	Metadata exported.PollMetadata
}

SetMetadataCalls gets all the calls that were made to SetMetadata. Check the length with:

len(mockedStore.SetMetadataCalls())

func (*StoreMock) SetVote

SetVote calls SetVoteFunc.

func (*StoreMock) SetVoteCalls

func (mock *StoreMock) SetVoteCalls() []struct {
	Voter github_com_cosmos_cosmos_sdk_types.ValAddress
	Vote  types.TalliedVote
}

SetVoteCalls gets all the calls that were made to SetVote. Check the length with:

len(mockedStore.SetVoteCalls())

Jump to

Keyboard shortcuts

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