mock

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyMock

type KeyMock struct {
	// GetBondedWeightFunc mocks the GetBondedWeight method.
	GetBondedWeightFunc func() sdk.Uint

	// GetHeightFunc mocks the GetHeight method.
	GetHeightFunc func() int64

	// GetMinPassingWeightFunc mocks the GetMinPassingWeight method.
	GetMinPassingWeightFunc func() sdk.Uint

	// GetParticipantsFunc mocks the GetParticipants method.
	GetParticipantsFunc func() []sdk.ValAddress

	// GetPubKeyFunc mocks the GetPubKey method.
	GetPubKeyFunc func(valAddress sdk.ValAddress) (multisigexported.PublicKey, bool)

	// GetSnapshotFunc mocks the GetSnapshot method.
	GetSnapshotFunc func() snapshotexported.Snapshot

	// GetStateFunc mocks the GetState method.
	GetStateFunc func() multisigexported.KeyState

	// GetTimestampFunc mocks the GetTimestamp method.
	GetTimestampFunc func() time.Time

	// GetWeightFunc mocks the GetWeight method.
	GetWeightFunc func(valAddress sdk.ValAddress) sdk.Uint
	// contains filtered or unexported fields
}

KeyMock is a mock implementation of multisigexported.Key.

func TestSomethingThatUsesKey(t *testing.T) {

	// make and configure a mocked multisigexported.Key
	mockedKey := &KeyMock{
		GetBondedWeightFunc: func() sdk.Uint {
			panic("mock out the GetBondedWeight method")
		},
		GetHeightFunc: func() int64 {
			panic("mock out the GetHeight method")
		},
		GetMinPassingWeightFunc: func() sdk.Uint {
			panic("mock out the GetMinPassingWeight method")
		},
		GetParticipantsFunc: func() []sdk.ValAddress {
			panic("mock out the GetParticipants method")
		},
		GetPubKeyFunc: func(valAddress sdk.ValAddress) (multisigexported.PublicKey, bool) {
			panic("mock out the GetPubKey method")
		},
		GetSnapshotFunc: func() snapshotexported.Snapshot {
			panic("mock out the GetSnapshot method")
		},
		GetStateFunc: func() multisigexported.KeyState {
			panic("mock out the GetState method")
		},
		GetTimestampFunc: func() time.Time {
			panic("mock out the GetTimestamp method")
		},
		GetWeightFunc: func(valAddress sdk.ValAddress) sdk.Uint {
			panic("mock out the GetWeight method")
		},
	}

	// use mockedKey in code that requires multisigexported.Key
	// and then make assertions.

}

func (*KeyMock) GetBondedWeight

func (mock *KeyMock) GetBondedWeight() sdk.Uint

GetBondedWeight calls GetBondedWeightFunc.

func (*KeyMock) GetBondedWeightCalls

func (mock *KeyMock) GetBondedWeightCalls() []struct {
}

GetBondedWeightCalls gets all the calls that were made to GetBondedWeight. Check the length with:

len(mockedKey.GetBondedWeightCalls())

func (*KeyMock) GetHeight

func (mock *KeyMock) GetHeight() int64

GetHeight calls GetHeightFunc.

func (*KeyMock) GetHeightCalls

func (mock *KeyMock) GetHeightCalls() []struct {
}

GetHeightCalls gets all the calls that were made to GetHeight. Check the length with:

len(mockedKey.GetHeightCalls())

func (*KeyMock) GetMinPassingWeight

func (mock *KeyMock) GetMinPassingWeight() sdk.Uint

GetMinPassingWeight calls GetMinPassingWeightFunc.

func (*KeyMock) GetMinPassingWeightCalls

func (mock *KeyMock) GetMinPassingWeightCalls() []struct {
}

GetMinPassingWeightCalls gets all the calls that were made to GetMinPassingWeight. Check the length with:

len(mockedKey.GetMinPassingWeightCalls())

func (*KeyMock) GetParticipants

func (mock *KeyMock) GetParticipants() []sdk.ValAddress

GetParticipants calls GetParticipantsFunc.

func (*KeyMock) GetParticipantsCalls

func (mock *KeyMock) GetParticipantsCalls() []struct {
}

GetParticipantsCalls gets all the calls that were made to GetParticipants. Check the length with:

len(mockedKey.GetParticipantsCalls())

func (*KeyMock) GetPubKey

func (mock *KeyMock) GetPubKey(valAddress sdk.ValAddress) (multisigexported.PublicKey, bool)

GetPubKey calls GetPubKeyFunc.

func (*KeyMock) GetPubKeyCalls

func (mock *KeyMock) GetPubKeyCalls() []struct {
	ValAddress sdk.ValAddress
}

GetPubKeyCalls gets all the calls that were made to GetPubKey. Check the length with:

len(mockedKey.GetPubKeyCalls())

func (*KeyMock) GetSnapshot added in v0.21.1

func (mock *KeyMock) GetSnapshot() snapshotexported.Snapshot

GetSnapshot calls GetSnapshotFunc.

func (*KeyMock) GetSnapshotCalls added in v0.21.1

func (mock *KeyMock) GetSnapshotCalls() []struct {
}

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

len(mockedKey.GetSnapshotCalls())

func (*KeyMock) GetState

func (mock *KeyMock) GetState() multisigexported.KeyState

GetState calls GetStateFunc.

func (*KeyMock) GetStateCalls

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

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

len(mockedKey.GetStateCalls())

func (*KeyMock) GetTimestamp

func (mock *KeyMock) GetTimestamp() time.Time

GetTimestamp calls GetTimestampFunc.

func (*KeyMock) GetTimestampCalls

func (mock *KeyMock) GetTimestampCalls() []struct {
}

GetTimestampCalls gets all the calls that were made to GetTimestamp. Check the length with:

len(mockedKey.GetTimestampCalls())

func (*KeyMock) GetWeight

func (mock *KeyMock) GetWeight(valAddress sdk.ValAddress) sdk.Uint

GetWeight calls GetWeightFunc.

func (*KeyMock) GetWeightCalls

func (mock *KeyMock) GetWeightCalls() []struct {
	ValAddress sdk.ValAddress
}

GetWeightCalls gets all the calls that were made to GetWeight. Check the length with:

len(mockedKey.GetWeightCalls())

type SigHandlerMock

type SigHandlerMock struct {
	// HandleCompletedFunc mocks the HandleCompleted method.
	HandleCompletedFunc func(ctx sdk.Context, sig codec.ProtoMarshaler, moduleMetadata codec.ProtoMarshaler) error

	// HandleFailedFunc mocks the HandleFailed method.
	HandleFailedFunc func(ctx sdk.Context, moduleMetadata codec.ProtoMarshaler) error
	// contains filtered or unexported fields
}

SigHandlerMock is a mock implementation of multisigexported.SigHandler.

func TestSomethingThatUsesSigHandler(t *testing.T) {

	// make and configure a mocked multisigexported.SigHandler
	mockedSigHandler := &SigHandlerMock{
		HandleCompletedFunc: func(ctx sdk.Context, sig codec.ProtoMarshaler, moduleMetadata codec.ProtoMarshaler) error {
			panic("mock out the HandleCompleted method")
		},
		HandleFailedFunc: func(ctx sdk.Context, moduleMetadata codec.ProtoMarshaler) error {
			panic("mock out the HandleFailed method")
		},
	}

	// use mockedSigHandler in code that requires multisigexported.SigHandler
	// and then make assertions.

}

func (*SigHandlerMock) HandleCompleted

func (mock *SigHandlerMock) HandleCompleted(ctx sdk.Context, sig codec.ProtoMarshaler, moduleMetadata codec.ProtoMarshaler) error

HandleCompleted calls HandleCompletedFunc.

func (*SigHandlerMock) HandleCompletedCalls

func (mock *SigHandlerMock) HandleCompletedCalls() []struct {
	Ctx            sdk.Context
	Sig            codec.ProtoMarshaler
	ModuleMetadata codec.ProtoMarshaler
}

HandleCompletedCalls gets all the calls that were made to HandleCompleted. Check the length with:

len(mockedSigHandler.HandleCompletedCalls())

func (*SigHandlerMock) HandleFailed

func (mock *SigHandlerMock) HandleFailed(ctx sdk.Context, moduleMetadata codec.ProtoMarshaler) error

HandleFailed calls HandleFailedFunc.

func (*SigHandlerMock) HandleFailedCalls

func (mock *SigHandlerMock) HandleFailedCalls() []struct {
	Ctx            sdk.Context
	ModuleMetadata codec.ProtoMarshaler
}

HandleFailedCalls gets all the calls that were made to HandleFailed. Check the length with:

len(mockedSigHandler.HandleFailedCalls())

Jump to

Keyboard shortcuts

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