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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PollMock

type PollMock struct {
	// GetIDFunc mocks the GetID method.
	GetIDFunc func() exported.PollID

	// GetMetaDataFunc mocks the GetMetaData method.
	GetMetaDataFunc func() (codec.ProtoMarshaler, bool)

	// GetModuleFunc mocks the GetModule method.
	GetModuleFunc func() string

	// GetResultFunc mocks the GetResult method.
	GetResultFunc func() codec.ProtoMarshaler

	// GetRewardPoolNameFunc mocks the GetRewardPoolName method.
	GetRewardPoolNameFunc func() (string, bool)

	// GetStateFunc mocks the GetState method.
	GetStateFunc func() exported.PollState

	// GetVotersFunc mocks the GetVoters method.
	GetVotersFunc func() []github_com_cosmos_cosmos_sdk_types.ValAddress

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

	// HasVotedCorrectlyFunc mocks the HasVotedCorrectly method.
	HasVotedCorrectlyFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool

	// VoteFunc mocks the Vote method.
	VoteFunc func(voter github_com_cosmos_cosmos_sdk_types.ValAddress, blockHeight int64, data codec.ProtoMarshaler) (exported.VoteResult, error)
	// contains filtered or unexported fields
}

PollMock is a mock implementation of exported.Poll.

func TestSomethingThatUsesPoll(t *testing.T) {

	// make and configure a mocked exported.Poll
	mockedPoll := &PollMock{
		GetIDFunc: func() exported.PollID {
			panic("mock out the GetID method")
		},
		GetMetaDataFunc: func() (codec.ProtoMarshaler, bool) {
			panic("mock out the GetMetaData method")
		},
		GetModuleFunc: func() string {
			panic("mock out the GetModule method")
		},
		GetResultFunc: func() codec.ProtoMarshaler {
			panic("mock out the GetResult method")
		},
		GetRewardPoolNameFunc: func() (string, bool) {
			panic("mock out the GetRewardPoolName method")
		},
		GetStateFunc: func() exported.PollState {
			panic("mock out the GetState method")
		},
		GetVotersFunc: func() []github_com_cosmos_cosmos_sdk_types.ValAddress {
			panic("mock out the GetVoters method")
		},
		HasVotedFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
			panic("mock out the HasVoted method")
		},
		HasVotedCorrectlyFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool {
			panic("mock out the HasVotedCorrectly method")
		},
		VoteFunc: func(voter github_com_cosmos_cosmos_sdk_types.ValAddress, blockHeight int64, data codec.ProtoMarshaler) (exported.VoteResult, error) {
			panic("mock out the Vote method")
		},
	}

	// use mockedPoll in code that requires exported.Poll
	// and then make assertions.

}

func (*PollMock) GetID added in v0.21.0

func (mock *PollMock) GetID() exported.PollID

GetID calls GetIDFunc.

func (*PollMock) GetIDCalls added in v0.21.0

func (mock *PollMock) GetIDCalls() []struct {
}

GetIDCalls gets all the calls that were made to GetID. Check the length with:

len(mockedPoll.GetIDCalls())

func (*PollMock) GetMetaData added in v0.21.0

func (mock *PollMock) GetMetaData() (codec.ProtoMarshaler, bool)

GetMetaData calls GetMetaDataFunc.

func (*PollMock) GetMetaDataCalls added in v0.21.0

func (mock *PollMock) GetMetaDataCalls() []struct {
}

GetMetaDataCalls gets all the calls that were made to GetMetaData. Check the length with:

len(mockedPoll.GetMetaDataCalls())

func (*PollMock) GetModule added in v0.21.0

func (mock *PollMock) GetModule() string

GetModule calls GetModuleFunc.

func (*PollMock) GetModuleCalls added in v0.21.0

func (mock *PollMock) GetModuleCalls() []struct {
}

GetModuleCalls gets all the calls that were made to GetModule. Check the length with:

len(mockedPoll.GetModuleCalls())

func (*PollMock) GetResult

func (mock *PollMock) GetResult() codec.ProtoMarshaler

GetResult calls GetResultFunc.

func (*PollMock) GetResultCalls

func (mock *PollMock) GetResultCalls() []struct {
}

GetResultCalls gets all the calls that were made to GetResult. Check the length with:

len(mockedPoll.GetResultCalls())

func (*PollMock) GetRewardPoolName added in v0.18.0

func (mock *PollMock) GetRewardPoolName() (string, bool)

GetRewardPoolName calls GetRewardPoolNameFunc.

func (*PollMock) GetRewardPoolNameCalls added in v0.18.0

func (mock *PollMock) GetRewardPoolNameCalls() []struct {
}

GetRewardPoolNameCalls gets all the calls that were made to GetRewardPoolName. Check the length with:

len(mockedPoll.GetRewardPoolNameCalls())

func (*PollMock) GetState added in v0.21.0

func (mock *PollMock) GetState() exported.PollState

GetState calls GetStateFunc.

func (*PollMock) GetStateCalls added in v0.21.0

func (mock *PollMock) GetStateCalls() []struct {
}

GetStateCalls gets all the calls that were made to GetState. Check the length with:

len(mockedPoll.GetStateCalls())

func (*PollMock) GetVoters

GetVoters calls GetVotersFunc.

func (*PollMock) GetVotersCalls

func (mock *PollMock) GetVotersCalls() []struct {
}

GetVotersCalls gets all the calls that were made to GetVoters. Check the length with:

len(mockedPoll.GetVotersCalls())

func (*PollMock) HasVoted added in v0.18.0

HasVoted calls HasVotedFunc.

func (*PollMock) HasVotedCalls added in v0.18.0

func (mock *PollMock) 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(mockedPoll.HasVotedCalls())

func (*PollMock) HasVotedCorrectly added in v0.18.0

func (mock *PollMock) HasVotedCorrectly(voter github_com_cosmos_cosmos_sdk_types.ValAddress) bool

HasVotedCorrectly calls HasVotedCorrectlyFunc.

func (*PollMock) HasVotedCorrectlyCalls added in v0.18.0

func (mock *PollMock) HasVotedCorrectlyCalls() []struct {
	Voter github_com_cosmos_cosmos_sdk_types.ValAddress
}

HasVotedCorrectlyCalls gets all the calls that were made to HasVotedCorrectly. Check the length with:

len(mockedPoll.HasVotedCorrectlyCalls())

func (*PollMock) Vote

Vote calls VoteFunc.

func (*PollMock) VoteCalls

func (mock *PollMock) VoteCalls() []struct {
	Voter       github_com_cosmos_cosmos_sdk_types.ValAddress
	BlockHeight int64
	Data        codec.ProtoMarshaler
}

VoteCalls gets all the calls that were made to Vote. Check the length with:

len(mockedPoll.VoteCalls())

type VoteHandlerMock added in v0.18.0

type VoteHandlerMock struct {
	// HandleCompletedPollFunc mocks the HandleCompletedPoll method.
	HandleCompletedPollFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error

	// HandleExpiredPollFunc mocks the HandleExpiredPoll method.
	HandleExpiredPollFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error

	// HandleFailedPollFunc mocks the HandleFailedPoll method.
	HandleFailedPollFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error

	// HandleResultFunc mocks the HandleResult method.
	HandleResultFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, result codec.ProtoMarshaler) error

	// IsFalsyResultFunc mocks the IsFalsyResult method.
	IsFalsyResultFunc func(result codec.ProtoMarshaler) bool
	// contains filtered or unexported fields
}

VoteHandlerMock is a mock implementation of exported.VoteHandler.

func TestSomethingThatUsesVoteHandler(t *testing.T) {

	// make and configure a mocked exported.VoteHandler
	mockedVoteHandler := &VoteHandlerMock{
		HandleCompletedPollFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
			panic("mock out the HandleCompletedPoll method")
		},
		HandleExpiredPollFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
			panic("mock out the HandleExpiredPoll method")
		},
		HandleFailedPollFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error {
			panic("mock out the HandleFailedPoll method")
		},
		HandleResultFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, result codec.ProtoMarshaler) error {
			panic("mock out the HandleResult method")
		},
		IsFalsyResultFunc: func(result codec.ProtoMarshaler) bool {
			panic("mock out the IsFalsyResult method")
		},
	}

	// use mockedVoteHandler in code that requires exported.VoteHandler
	// and then make assertions.

}

func (*VoteHandlerMock) HandleCompletedPoll added in v0.18.0

func (mock *VoteHandlerMock) HandleCompletedPoll(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error

HandleCompletedPoll calls HandleCompletedPollFunc.

func (*VoteHandlerMock) HandleCompletedPollCalls added in v0.18.0

func (mock *VoteHandlerMock) HandleCompletedPollCalls() []struct {
	Ctx  github_com_cosmos_cosmos_sdk_types.Context
	Poll exported.Poll
}

HandleCompletedPollCalls gets all the calls that were made to HandleCompletedPoll. Check the length with:

len(mockedVoteHandler.HandleCompletedPollCalls())

func (*VoteHandlerMock) HandleExpiredPoll added in v0.18.0

func (mock *VoteHandlerMock) HandleExpiredPoll(ctx github_com_cosmos_cosmos_sdk_types.Context, poll exported.Poll) error

HandleExpiredPoll calls HandleExpiredPollFunc.

func (*VoteHandlerMock) HandleExpiredPollCalls added in v0.18.0

func (mock *VoteHandlerMock) HandleExpiredPollCalls() []struct {
	Ctx  github_com_cosmos_cosmos_sdk_types.Context
	Poll exported.Poll
}

HandleExpiredPollCalls gets all the calls that were made to HandleExpiredPoll. Check the length with:

len(mockedVoteHandler.HandleExpiredPollCalls())

func (*VoteHandlerMock) HandleFailedPoll added in v0.21.0

HandleFailedPoll calls HandleFailedPollFunc.

func (*VoteHandlerMock) HandleFailedPollCalls added in v0.21.0

func (mock *VoteHandlerMock) HandleFailedPollCalls() []struct {
	Ctx  github_com_cosmos_cosmos_sdk_types.Context
	Poll exported.Poll
}

HandleFailedPollCalls gets all the calls that were made to HandleFailedPoll. Check the length with:

len(mockedVoteHandler.HandleFailedPollCalls())

func (*VoteHandlerMock) HandleResult added in v0.18.0

HandleResult calls HandleResultFunc.

func (*VoteHandlerMock) HandleResultCalls added in v0.18.0

func (mock *VoteHandlerMock) HandleResultCalls() []struct {
	Ctx    github_com_cosmos_cosmos_sdk_types.Context
	Result codec.ProtoMarshaler
}

HandleResultCalls gets all the calls that were made to HandleResult. Check the length with:

len(mockedVoteHandler.HandleResultCalls())

func (*VoteHandlerMock) IsFalsyResult added in v0.18.0

func (mock *VoteHandlerMock) IsFalsyResult(result codec.ProtoMarshaler) bool

IsFalsyResult calls IsFalsyResultFunc.

func (*VoteHandlerMock) IsFalsyResultCalls added in v0.18.0

func (mock *VoteHandlerMock) IsFalsyResultCalls() []struct {
	Result codec.ProtoMarshaler
}

IsFalsyResultCalls gets all the calls that were made to IsFalsyResult. Check the length with:

len(mockedVoteHandler.IsFalsyResultCalls())

Jump to

Keyboard shortcuts

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