mock

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 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 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 MultiSigMock added in v0.27.0

type MultiSigMock struct {
	// GetKeyIDFunc mocks the GetKeyID method.
	GetKeyIDFunc func() multisigexported.KeyID

	// GetPayloadHashFunc mocks the GetPayloadHash method.
	GetPayloadHashFunc func() multisigexported.Hash

	// GetSignatureFunc mocks the GetSignature method.
	GetSignatureFunc func(p sdk.ValAddress) (ecdsa.Signature, bool)

	// ValidateBasicFunc mocks the ValidateBasic method.
	ValidateBasicFunc func() error
	// contains filtered or unexported fields
}

MultiSigMock is a mock implementation of multisigexported.MultiSig.

func TestSomethingThatUsesMultiSig(t *testing.T) {

	// make and configure a mocked multisigexported.MultiSig
	mockedMultiSig := &MultiSigMock{
		GetKeyIDFunc: func() multisigexported.KeyID {
			panic("mock out the GetKeyID method")
		},
		GetPayloadHashFunc: func() multisigexported.Hash {
			panic("mock out the GetPayloadHash method")
		},
		GetSignatureFunc: func(p sdk.ValAddress) (ecdsa.Signature, bool) {
			panic("mock out the GetSignature method")
		},
		ValidateBasicFunc: func() error {
			panic("mock out the ValidateBasic method")
		},
	}

	// use mockedMultiSig in code that requires multisigexported.MultiSig
	// and then make assertions.

}

func (*MultiSigMock) GetKeyID added in v0.27.0

func (mock *MultiSigMock) GetKeyID() multisigexported.KeyID

GetKeyID calls GetKeyIDFunc.

func (*MultiSigMock) GetKeyIDCalls added in v0.27.0

func (mock *MultiSigMock) GetKeyIDCalls() []struct {
}

GetKeyIDCalls gets all the calls that were made to GetKeyID. Check the length with:

len(mockedMultiSig.GetKeyIDCalls())

func (*MultiSigMock) GetPayloadHash added in v0.27.0

func (mock *MultiSigMock) GetPayloadHash() multisigexported.Hash

GetPayloadHash calls GetPayloadHashFunc.

func (*MultiSigMock) GetPayloadHashCalls added in v0.27.0

func (mock *MultiSigMock) GetPayloadHashCalls() []struct {
}

GetPayloadHashCalls gets all the calls that were made to GetPayloadHash. Check the length with:

len(mockedMultiSig.GetPayloadHashCalls())

func (*MultiSigMock) GetSignature added in v0.27.0

func (mock *MultiSigMock) GetSignature(p sdk.ValAddress) (ecdsa.Signature, bool)

GetSignature calls GetSignatureFunc.

func (*MultiSigMock) GetSignatureCalls added in v0.27.0

func (mock *MultiSigMock) GetSignatureCalls() []struct {
	P sdk.ValAddress
}

GetSignatureCalls gets all the calls that were made to GetSignature. Check the length with:

len(mockedMultiSig.GetSignatureCalls())

func (*MultiSigMock) ValidateBasic added in v0.27.0

func (mock *MultiSigMock) ValidateBasic() error

ValidateBasic calls ValidateBasicFunc.

func (*MultiSigMock) ValidateBasicCalls added in v0.27.0

func (mock *MultiSigMock) ValidateBasicCalls() []struct {
}

ValidateBasicCalls gets all the calls that were made to ValidateBasic. Check the length with:

len(mockedMultiSig.ValidateBasicCalls())

type SigHandlerMock

type SigHandlerMock struct {
	// HandleCompletedFunc mocks the HandleCompleted method.
	HandleCompletedFunc func(ctx sdk.Context, sig utils.ValidatedProtoMarshaler, 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 utils.ValidatedProtoMarshaler, 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 utils.ValidatedProtoMarshaler, moduleMetadata codec.ProtoMarshaler) error

HandleCompleted calls HandleCompletedFunc.

func (*SigHandlerMock) HandleCompletedCalls

func (mock *SigHandlerMock) HandleCompletedCalls() []struct {
	Ctx            sdk.Context
	Sig            utils.ValidatedProtoMarshaler
	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