mock

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 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 SDKValidatorMock

type SDKValidatorMock struct {
	// GetConsAddrFunc mocks the GetConsAddr method.
	GetConsAddrFunc func() (github_com_cosmos_cosmos_sdk_types.ConsAddress, error)

	// GetConsensusPowerFunc mocks the GetConsensusPower method.
	GetConsensusPowerFunc func(intMoqParam github_com_cosmos_cosmos_sdk_types.Int) int64

	// GetOperatorFunc mocks the GetOperator method.
	GetOperatorFunc func() github_com_cosmos_cosmos_sdk_types.ValAddress

	// IsBondedFunc mocks the IsBonded method.
	IsBondedFunc func() bool

	// IsJailedFunc mocks the IsJailed method.
	IsJailedFunc func() bool

	// ProtoMessageFunc mocks the ProtoMessage method.
	ProtoMessageFunc func()

	// ResetFunc mocks the Reset method.
	ResetFunc func()

	// StringFunc mocks the String method.
	StringFunc func() string

	// UnpackInterfacesFunc mocks the UnpackInterfaces method.
	UnpackInterfacesFunc func(unpacker types.AnyUnpacker) error
	// contains filtered or unexported fields
}

SDKValidatorMock is a mock implementation of snapshotexported.SDKValidator.

func TestSomethingThatUsesSDKValidator(t *testing.T) {

	// make and configure a mocked snapshotexported.SDKValidator
	mockedSDKValidator := &SDKValidatorMock{
		GetConsAddrFunc: func() (github_com_cosmos_cosmos_sdk_types.ConsAddress, error) {
			panic("mock out the GetConsAddr method")
		},
		GetConsensusPowerFunc: func(intMoqParam github_com_cosmos_cosmos_sdk_types.Int) int64 {
			panic("mock out the GetConsensusPower method")
		},
		GetOperatorFunc: func() github_com_cosmos_cosmos_sdk_types.ValAddress {
			panic("mock out the GetOperator method")
		},
		IsBondedFunc: func() bool {
			panic("mock out the IsBonded method")
		},
		IsJailedFunc: func() bool {
			panic("mock out the IsJailed method")
		},
		ProtoMessageFunc: func()  {
			panic("mock out the ProtoMessage method")
		},
		ResetFunc: func()  {
			panic("mock out the Reset method")
		},
		StringFunc: func() string {
			panic("mock out the String method")
		},
		UnpackInterfacesFunc: func(unpacker types.AnyUnpacker) error {
			panic("mock out the UnpackInterfaces method")
		},
	}

	// use mockedSDKValidator in code that requires snapshotexported.SDKValidator
	// and then make assertions.

}

func (*SDKValidatorMock) GetConsAddr

GetConsAddr calls GetConsAddrFunc.

func (*SDKValidatorMock) GetConsAddrCalls

func (mock *SDKValidatorMock) GetConsAddrCalls() []struct {
}

GetConsAddrCalls gets all the calls that were made to GetConsAddr. Check the length with:

len(mockedSDKValidator.GetConsAddrCalls())

func (*SDKValidatorMock) GetConsensusPower

func (mock *SDKValidatorMock) GetConsensusPower(intMoqParam github_com_cosmos_cosmos_sdk_types.Int) int64

GetConsensusPower calls GetConsensusPowerFunc.

func (*SDKValidatorMock) GetConsensusPowerCalls

func (mock *SDKValidatorMock) GetConsensusPowerCalls() []struct {
	IntMoqParam github_com_cosmos_cosmos_sdk_types.Int
}

GetConsensusPowerCalls gets all the calls that were made to GetConsensusPower. Check the length with:

len(mockedSDKValidator.GetConsensusPowerCalls())

func (*SDKValidatorMock) GetOperator

GetOperator calls GetOperatorFunc.

func (*SDKValidatorMock) GetOperatorCalls

func (mock *SDKValidatorMock) GetOperatorCalls() []struct {
}

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

len(mockedSDKValidator.GetOperatorCalls())

func (*SDKValidatorMock) IsBonded added in v0.14.0

func (mock *SDKValidatorMock) IsBonded() bool

IsBonded calls IsBondedFunc.

func (*SDKValidatorMock) IsBondedCalls added in v0.14.0

func (mock *SDKValidatorMock) IsBondedCalls() []struct {
}

IsBondedCalls gets all the calls that were made to IsBonded. Check the length with:

len(mockedSDKValidator.IsBondedCalls())

func (*SDKValidatorMock) IsJailed

func (mock *SDKValidatorMock) IsJailed() bool

IsJailed calls IsJailedFunc.

func (*SDKValidatorMock) IsJailedCalls

func (mock *SDKValidatorMock) IsJailedCalls() []struct {
}

IsJailedCalls gets all the calls that were made to IsJailed. Check the length with:

len(mockedSDKValidator.IsJailedCalls())

func (*SDKValidatorMock) ProtoMessage

func (mock *SDKValidatorMock) ProtoMessage()

ProtoMessage calls ProtoMessageFunc.

func (*SDKValidatorMock) ProtoMessageCalls

func (mock *SDKValidatorMock) ProtoMessageCalls() []struct {
}

ProtoMessageCalls gets all the calls that were made to ProtoMessage. Check the length with:

len(mockedSDKValidator.ProtoMessageCalls())

func (*SDKValidatorMock) Reset

func (mock *SDKValidatorMock) Reset()

Reset calls ResetFunc.

func (*SDKValidatorMock) ResetCalls

func (mock *SDKValidatorMock) ResetCalls() []struct {
}

ResetCalls gets all the calls that were made to Reset. Check the length with:

len(mockedSDKValidator.ResetCalls())

func (*SDKValidatorMock) String

func (mock *SDKValidatorMock) String() string

String calls StringFunc.

func (*SDKValidatorMock) StringCalls

func (mock *SDKValidatorMock) StringCalls() []struct {
}

StringCalls gets all the calls that were made to String. Check the length with:

len(mockedSDKValidator.StringCalls())

func (*SDKValidatorMock) UnpackInterfaces

func (mock *SDKValidatorMock) UnpackInterfaces(unpacker types.AnyUnpacker) error

UnpackInterfaces calls UnpackInterfacesFunc.

func (*SDKValidatorMock) UnpackInterfacesCalls

func (mock *SDKValidatorMock) UnpackInterfacesCalls() []struct {
	Unpacker types.AnyUnpacker
}

UnpackInterfacesCalls gets all the calls that were made to UnpackInterfaces. Check the length with:

len(mockedSDKValidator.UnpackInterfacesCalls())

type SlasherMock

type SlasherMock struct {
	// GetValidatorMissedBlockBitArrayFunc mocks the GetValidatorMissedBlockBitArray method.
	GetValidatorMissedBlockBitArrayFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress, index int64) bool

	// GetValidatorSigningInfoFunc mocks the GetValidatorSigningInfo method.
	GetValidatorSigningInfoFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress) (slashingtypes.ValidatorSigningInfo, bool)

	// SignedBlocksWindowFunc mocks the SignedBlocksWindow method.
	SignedBlocksWindowFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) int64
	// contains filtered or unexported fields
}

SlasherMock is a mock implementation of snapshotexported.Slasher.

func TestSomethingThatUsesSlasher(t *testing.T) {

	// make and configure a mocked snapshotexported.Slasher
	mockedSlasher := &SlasherMock{
		GetValidatorMissedBlockBitArrayFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress, index int64) bool {
			panic("mock out the GetValidatorMissedBlockBitArray method")
		},
		GetValidatorSigningInfoFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress) (slashingtypes.ValidatorSigningInfo, bool) {
			panic("mock out the GetValidatorSigningInfo method")
		},
		SignedBlocksWindowFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) int64 {
			panic("mock out the SignedBlocksWindow method")
		},
	}

	// use mockedSlasher in code that requires snapshotexported.Slasher
	// and then make assertions.

}

func (*SlasherMock) GetValidatorMissedBlockBitArray added in v0.13.0

func (mock *SlasherMock) GetValidatorMissedBlockBitArray(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress, index int64) bool

GetValidatorMissedBlockBitArray calls GetValidatorMissedBlockBitArrayFunc.

func (*SlasherMock) GetValidatorMissedBlockBitArrayCalls added in v0.13.0

func (mock *SlasherMock) GetValidatorMissedBlockBitArrayCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Address github_com_cosmos_cosmos_sdk_types.ConsAddress
	Index   int64
}

GetValidatorMissedBlockBitArrayCalls gets all the calls that were made to GetValidatorMissedBlockBitArray. Check the length with:

len(mockedSlasher.GetValidatorMissedBlockBitArrayCalls())

func (*SlasherMock) GetValidatorSigningInfo

GetValidatorSigningInfo calls GetValidatorSigningInfoFunc.

func (*SlasherMock) GetValidatorSigningInfoCalls

func (mock *SlasherMock) GetValidatorSigningInfoCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Address github_com_cosmos_cosmos_sdk_types.ConsAddress
}

GetValidatorSigningInfoCalls gets all the calls that were made to GetValidatorSigningInfo. Check the length with:

len(mockedSlasher.GetValidatorSigningInfoCalls())

func (*SlasherMock) SignedBlocksWindow

func (mock *SlasherMock) SignedBlocksWindow(ctx github_com_cosmos_cosmos_sdk_types.Context) int64

SignedBlocksWindow calls SignedBlocksWindowFunc.

func (*SlasherMock) SignedBlocksWindowCalls

func (mock *SlasherMock) SignedBlocksWindowCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
}

SignedBlocksWindowCalls gets all the calls that were made to SignedBlocksWindow. Check the length with:

len(mockedSlasher.SignedBlocksWindowCalls())

type SnapshotterMock

type SnapshotterMock struct {
	// GetLatestSnapshotFunc mocks the GetLatestSnapshot method.
	GetLatestSnapshotFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context) (snapshotexported.Snapshot, bool)

	// GetOperatorFunc mocks the GetOperator method.
	GetOperatorFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, proxy github_com_cosmos_cosmos_sdk_types.AccAddress) github_com_cosmos_cosmos_sdk_types.ValAddress

	// GetProxyFunc mocks the GetProxy method.
	GetProxyFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, principal github_com_cosmos_cosmos_sdk_types.ValAddress) (github_com_cosmos_cosmos_sdk_types.AccAddress, bool)

	// GetSnapshotFunc mocks the GetSnapshot method.
	GetSnapshotFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, seqNo int64) (snapshotexported.Snapshot, bool)

	// GetValidatorIllegibilityFunc mocks the GetValidatorIllegibility method.
	GetValidatorIllegibilityFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, validator snapshotexported.SDKValidator) (snapshotexported.ValidatorIllegibility, error)

	// TakeSnapshotFunc mocks the TakeSnapshot method.
	TakeSnapshotFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, keyRequirement tssexported.KeyRequirement) (snapshotexported.Snapshot, error)
	// contains filtered or unexported fields
}

SnapshotterMock is a mock implementation of snapshotexported.Snapshotter.

func TestSomethingThatUsesSnapshotter(t *testing.T) {

	// make and configure a mocked snapshotexported.Snapshotter
	mockedSnapshotter := &SnapshotterMock{
		GetLatestSnapshotFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context) (snapshotexported.Snapshot, bool) {
			panic("mock out the GetLatestSnapshot method")
		},
		GetOperatorFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, proxy github_com_cosmos_cosmos_sdk_types.AccAddress) github_com_cosmos_cosmos_sdk_types.ValAddress {
			panic("mock out the GetOperator method")
		},
		GetProxyFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, principal github_com_cosmos_cosmos_sdk_types.ValAddress) (github_com_cosmos_cosmos_sdk_types.AccAddress, bool) {
			panic("mock out the GetProxy method")
		},
		GetSnapshotFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, seqNo int64) (snapshotexported.Snapshot, bool) {
			panic("mock out the GetSnapshot method")
		},
		GetValidatorIllegibilityFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, validator snapshotexported.SDKValidator) (snapshotexported.ValidatorIllegibility, error) {
			panic("mock out the GetValidatorIllegibility method")
		},
		TakeSnapshotFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, keyRequirement tssexported.KeyRequirement) (snapshotexported.Snapshot, error) {
			panic("mock out the TakeSnapshot method")
		},
	}

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

}

func (*SnapshotterMock) GetLatestSnapshot

GetLatestSnapshot calls GetLatestSnapshotFunc.

func (*SnapshotterMock) GetLatestSnapshotCalls

func (mock *SnapshotterMock) GetLatestSnapshotCalls() []struct {
	Ctx github_com_cosmos_cosmos_sdk_types.Context
}

GetLatestSnapshotCalls gets all the calls that were made to GetLatestSnapshot. Check the length with:

len(mockedSnapshotter.GetLatestSnapshotCalls())

func (*SnapshotterMock) GetOperator

GetOperator calls GetOperatorFunc.

func (*SnapshotterMock) GetOperatorCalls

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

len(mockedSnapshotter.GetOperatorCalls())

func (*SnapshotterMock) GetProxyCalls

GetProxyCalls gets all the calls that were made to GetProxy. Check the length with:

len(mockedSnapshotter.GetProxyCalls())

func (*SnapshotterMock) GetSnapshot

GetSnapshot calls GetSnapshotFunc.

func (*SnapshotterMock) GetSnapshotCalls

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

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

len(mockedSnapshotter.GetSnapshotCalls())

func (*SnapshotterMock) GetValidatorIllegibility

GetValidatorIllegibility calls GetValidatorIllegibilityFunc.

func (*SnapshotterMock) GetValidatorIllegibilityCalls

func (mock *SnapshotterMock) GetValidatorIllegibilityCalls() []struct {
	Ctx       github_com_cosmos_cosmos_sdk_types.Context
	Validator snapshotexported.SDKValidator
}

GetValidatorIllegibilityCalls gets all the calls that were made to GetValidatorIllegibility. Check the length with:

len(mockedSnapshotter.GetValidatorIllegibilityCalls())

func (*SnapshotterMock) TakeSnapshot

TakeSnapshot calls TakeSnapshotFunc.

func (*SnapshotterMock) TakeSnapshotCalls

func (mock *SnapshotterMock) TakeSnapshotCalls() []struct {
	Ctx            github_com_cosmos_cosmos_sdk_types.Context
	KeyRequirement tssexported.KeyRequirement
}

TakeSnapshotCalls gets all the calls that were made to TakeSnapshot. Check the length with:

len(mockedSnapshotter.TakeSnapshotCalls())

type TssMock

type TssMock struct {
	// GetKeyRequirementFunc mocks the GetKeyRequirement method.
	GetKeyRequirementFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, keyRole tssexported.KeyRole, keyType tssexported.KeyType) (tssexported.KeyRequirement, bool)

	// GetNextKeyFunc mocks the GetNextKey method.
	GetNextKeyFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, chain nexus.Chain, keyRole tssexported.KeyRole) (tssexported.Key, bool)

	// GetSuspendedUntilFunc mocks the GetSuspendedUntil method.
	GetSuspendedUntilFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, validator github_com_cosmos_cosmos_sdk_types.ValAddress) int64

	// HasMissedTooManyBlocksFunc mocks the HasMissedTooManyBlocks method.
	HasMissedTooManyBlocksFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress) (bool, error)

	// IsOperatorAvailableFunc mocks the IsOperatorAvailable method.
	IsOperatorAvailableFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, validator github_com_cosmos_cosmos_sdk_types.ValAddress, keyIDs ...tssexported.KeyID) bool
	// contains filtered or unexported fields
}

TssMock is a mock implementation of snapshotexported.Tss.

func TestSomethingThatUsesTss(t *testing.T) {

	// make and configure a mocked snapshotexported.Tss
	mockedTss := &TssMock{
		GetKeyRequirementFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, keyRole tssexported.KeyRole, keyType tssexported.KeyType) (tssexported.KeyRequirement, bool) {
			panic("mock out the GetKeyRequirement method")
		},
		GetNextKeyFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, chain nexus.Chain, keyRole tssexported.KeyRole) (tssexported.Key, bool) {
			panic("mock out the GetNextKey method")
		},
		GetSuspendedUntilFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, validator github_com_cosmos_cosmos_sdk_types.ValAddress) int64 {
			panic("mock out the GetSuspendedUntil method")
		},
		HasMissedTooManyBlocksFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, address github_com_cosmos_cosmos_sdk_types.ConsAddress) (bool, error) {
			panic("mock out the HasMissedTooManyBlocks method")
		},
		IsOperatorAvailableFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, validator github_com_cosmos_cosmos_sdk_types.ValAddress, keyIDs ...tssexported.KeyID) bool {
			panic("mock out the IsOperatorAvailable method")
		},
	}

	// use mockedTss in code that requires snapshotexported.Tss
	// and then make assertions.

}

func (*TssMock) GetKeyRequirement

GetKeyRequirement calls GetKeyRequirementFunc.

func (*TssMock) GetKeyRequirementCalls

func (mock *TssMock) GetKeyRequirementCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	KeyRole tssexported.KeyRole
	KeyType tssexported.KeyType
}

GetKeyRequirementCalls gets all the calls that were made to GetKeyRequirement. Check the length with:

len(mockedTss.GetKeyRequirementCalls())

func (*TssMock) GetNextKey

GetNextKey calls GetNextKeyFunc.

func (*TssMock) GetNextKeyCalls

func (mock *TssMock) GetNextKeyCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Chain   nexus.Chain
	KeyRole tssexported.KeyRole
}

GetNextKeyCalls gets all the calls that were made to GetNextKey. Check the length with:

len(mockedTss.GetNextKeyCalls())

func (*TssMock) GetSuspendedUntil added in v0.9.0

GetSuspendedUntil calls GetSuspendedUntilFunc.

func (*TssMock) GetSuspendedUntilCalls added in v0.9.0

func (mock *TssMock) GetSuspendedUntilCalls() []struct {
	Ctx       github_com_cosmos_cosmos_sdk_types.Context
	Validator github_com_cosmos_cosmos_sdk_types.ValAddress
}

GetSuspendedUntilCalls gets all the calls that were made to GetSuspendedUntil. Check the length with:

len(mockedTss.GetSuspendedUntilCalls())

func (*TssMock) HasMissedTooManyBlocks added in v0.13.0

HasMissedTooManyBlocks calls HasMissedTooManyBlocksFunc.

func (*TssMock) HasMissedTooManyBlocksCalls added in v0.13.0

func (mock *TssMock) HasMissedTooManyBlocksCalls() []struct {
	Ctx     github_com_cosmos_cosmos_sdk_types.Context
	Address github_com_cosmos_cosmos_sdk_types.ConsAddress
}

HasMissedTooManyBlocksCalls gets all the calls that were made to HasMissedTooManyBlocks. Check the length with:

len(mockedTss.HasMissedTooManyBlocksCalls())

func (*TssMock) IsOperatorAvailable

IsOperatorAvailable calls IsOperatorAvailableFunc.

func (*TssMock) IsOperatorAvailableCalls

func (mock *TssMock) IsOperatorAvailableCalls() []struct {
	Ctx       github_com_cosmos_cosmos_sdk_types.Context
	Validator github_com_cosmos_cosmos_sdk_types.ValAddress
	KeyIDs    []tssexported.KeyID
}

IsOperatorAvailableCalls gets all the calls that were made to IsOperatorAvailable. Check the length with:

len(mockedTss.IsOperatorAvailableCalls())

Jump to

Keyboard shortcuts

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