mock

package
v0.26.5 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 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 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 SnapshotterMock

type SnapshotterMock struct {
	// CreateSnapshotFunc mocks the CreateSnapshot method.
	CreateSnapshotFunc func(ctx github_com_cosmos_cosmos_sdk_types.Context, candidates []github_com_cosmos_cosmos_sdk_types.ValAddress, filterFunc func(snapshotexported.ValidatorI) bool, weightFunc func(consensusPower github_com_cosmos_cosmos_sdk_types.Uint) github_com_cosmos_cosmos_sdk_types.Uint, threshold utils.Threshold) (snapshotexported.Snapshot, error)

	// 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{
		CreateSnapshotFunc: func(ctx github_com_cosmos_cosmos_sdk_types.Context, candidates []github_com_cosmos_cosmos_sdk_types.ValAddress, filterFunc func(snapshotexported.ValidatorI) bool, weightFunc func(consensusPower github_com_cosmos_cosmos_sdk_types.Uint) github_com_cosmos_cosmos_sdk_types.Uint, threshold utils.Threshold) (snapshotexported.Snapshot, error) {
			panic("mock out the CreateSnapshot method")
		},
		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) CreateSnapshot added in v0.21.0

CreateSnapshot calls CreateSnapshotFunc.

func (*SnapshotterMock) CreateSnapshotCalls added in v0.21.0

CreateSnapshotCalls gets all the calls that were made to CreateSnapshot. Check the length with:

len(mockedSnapshotter.CreateSnapshotCalls())

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 ValidatorIMock added in v0.21.0

type ValidatorIMock 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
	// contains filtered or unexported fields
}

ValidatorIMock is a mock implementation of snapshotexported.ValidatorI.

func TestSomethingThatUsesValidatorI(t *testing.T) {

	// make and configure a mocked snapshotexported.ValidatorI
	mockedValidatorI := &ValidatorIMock{
		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")
		},
	}

	// use mockedValidatorI in code that requires snapshotexported.ValidatorI
	// and then make assertions.

}

func (*ValidatorIMock) GetConsAddr added in v0.21.0

GetConsAddr calls GetConsAddrFunc.

func (*ValidatorIMock) GetConsAddrCalls added in v0.21.0

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

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

len(mockedValidatorI.GetConsAddrCalls())

func (*ValidatorIMock) GetConsensusPower added in v0.21.0

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

GetConsensusPower calls GetConsensusPowerFunc.

func (*ValidatorIMock) GetConsensusPowerCalls added in v0.21.0

func (mock *ValidatorIMock) 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(mockedValidatorI.GetConsensusPowerCalls())

func (*ValidatorIMock) GetOperator added in v0.21.0

GetOperator calls GetOperatorFunc.

func (*ValidatorIMock) GetOperatorCalls added in v0.21.0

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

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

len(mockedValidatorI.GetOperatorCalls())

func (*ValidatorIMock) IsBonded added in v0.21.0

func (mock *ValidatorIMock) IsBonded() bool

IsBonded calls IsBondedFunc.

func (*ValidatorIMock) IsBondedCalls added in v0.21.0

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

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

len(mockedValidatorI.IsBondedCalls())

func (*ValidatorIMock) IsJailed added in v0.21.0

func (mock *ValidatorIMock) IsJailed() bool

IsJailed calls IsJailedFunc.

func (*ValidatorIMock) IsJailedCalls added in v0.21.0

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

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

len(mockedValidatorI.IsJailedCalls())

Jump to

Keyboard shortcuts

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