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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeeTx added in v0.36.0

type FeeTx sdk.FeeTx

FeeTx alias for mocking

type FeeTxMock added in v0.36.0

type FeeTxMock struct {
	// FeeGranterFunc mocks the FeeGranter method.
	FeeGranterFunc func() sdk.AccAddress

	// FeePayerFunc mocks the FeePayer method.
	FeePayerFunc func() sdk.AccAddress

	// GetFeeFunc mocks the GetFee method.
	GetFeeFunc func() sdk.Coins

	// GetGasFunc mocks the GetGas method.
	GetGasFunc func() uint64

	// GetMsgsFunc mocks the GetMsgs method.
	GetMsgsFunc func() []sdk.Msg

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

FeeTxMock is a mock implementation of FeeTx.

func TestSomethingThatUsesFeeTx(t *testing.T) {

	// make and configure a mocked FeeTx
	mockedFeeTx := &FeeTxMock{
		FeeGranterFunc: func() sdk.AccAddress {
			panic("mock out the FeeGranter method")
		},
		FeePayerFunc: func() sdk.AccAddress {
			panic("mock out the FeePayer method")
		},
		GetFeeFunc: func() sdk.Coins {
			panic("mock out the GetFee method")
		},
		GetGasFunc: func() uint64 {
			panic("mock out the GetGas method")
		},
		GetMsgsFunc: func() []sdk.Msg {
			panic("mock out the GetMsgs method")
		},
		ValidateBasicFunc: func() error {
			panic("mock out the ValidateBasic method")
		},
	}

	// use mockedFeeTx in code that requires FeeTx
	// and then make assertions.

}

func (*FeeTxMock) FeeGranter added in v0.36.0

func (mock *FeeTxMock) FeeGranter() sdk.AccAddress

FeeGranter calls FeeGranterFunc.

func (*FeeTxMock) FeeGranterCalls added in v0.36.0

func (mock *FeeTxMock) FeeGranterCalls() []struct {
}

FeeGranterCalls gets all the calls that were made to FeeGranter. Check the length with:

len(mockedFeeTx.FeeGranterCalls())

func (*FeeTxMock) FeePayer added in v0.36.0

func (mock *FeeTxMock) FeePayer() sdk.AccAddress

FeePayer calls FeePayerFunc.

func (*FeeTxMock) FeePayerCalls added in v0.36.0

func (mock *FeeTxMock) FeePayerCalls() []struct {
}

FeePayerCalls gets all the calls that were made to FeePayer. Check the length with:

len(mockedFeeTx.FeePayerCalls())

func (*FeeTxMock) GetFee added in v0.36.0

func (mock *FeeTxMock) GetFee() sdk.Coins

GetFee calls GetFeeFunc.

func (*FeeTxMock) GetFeeCalls added in v0.36.0

func (mock *FeeTxMock) GetFeeCalls() []struct {
}

GetFeeCalls gets all the calls that were made to GetFee. Check the length with:

len(mockedFeeTx.GetFeeCalls())

func (*FeeTxMock) GetGas added in v0.36.0

func (mock *FeeTxMock) GetGas() uint64

GetGas calls GetGasFunc.

func (*FeeTxMock) GetGasCalls added in v0.36.0

func (mock *FeeTxMock) GetGasCalls() []struct {
}

GetGasCalls gets all the calls that were made to GetGas. Check the length with:

len(mockedFeeTx.GetGasCalls())

func (*FeeTxMock) GetMsgs added in v0.36.0

func (mock *FeeTxMock) GetMsgs() []sdk.Msg

GetMsgs calls GetMsgsFunc.

func (*FeeTxMock) GetMsgsCalls added in v0.36.0

func (mock *FeeTxMock) GetMsgsCalls() []struct {
}

GetMsgsCalls gets all the calls that were made to GetMsgs. Check the length with:

len(mockedFeeTx.GetMsgsCalls())

func (*FeeTxMock) ValidateBasic added in v0.36.0

func (mock *FeeTxMock) ValidateBasic() error

ValidateBasic calls ValidateBasicFunc.

func (*FeeTxMock) ValidateBasicCalls added in v0.36.0

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

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

len(mockedFeeTx.ValidateBasicCalls())

type Msg

type Msg interface {
	sdk.Msg
	descriptor.Message
}

Msg alias for mocking

type MsgMock

type MsgMock struct {
	// DescriptorFunc mocks the Descriptor method.
	DescriptorFunc func() ([]byte, []int)

	// GetSignersFunc mocks the GetSigners method.
	GetSignersFunc func() []sdk.AccAddress

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

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

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

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

MsgMock is a mock implementation of Msg.

func TestSomethingThatUsesMsg(t *testing.T) {

	// make and configure a mocked Msg
	mockedMsg := &MsgMock{
		DescriptorFunc: func() ([]byte, []int) {
			panic("mock out the Descriptor method")
		},
		GetSignersFunc: func() []sdk.AccAddress {
			panic("mock out the GetSigners 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")
		},
		ValidateBasicFunc: func() error {
			panic("mock out the ValidateBasic method")
		},
	}

	// use mockedMsg in code that requires Msg
	// and then make assertions.

}

func (*MsgMock) Descriptor

func (mock *MsgMock) Descriptor() ([]byte, []int)

Descriptor calls DescriptorFunc.

func (*MsgMock) DescriptorCalls

func (mock *MsgMock) DescriptorCalls() []struct {
}

DescriptorCalls gets all the calls that were made to Descriptor. Check the length with:

len(mockedMsg.DescriptorCalls())

func (*MsgMock) GetSigners

func (mock *MsgMock) GetSigners() []sdk.AccAddress

GetSigners calls GetSignersFunc.

func (*MsgMock) GetSignersCalls

func (mock *MsgMock) GetSignersCalls() []struct {
}

GetSignersCalls gets all the calls that were made to GetSigners. Check the length with:

len(mockedMsg.GetSignersCalls())

func (*MsgMock) ProtoMessage

func (mock *MsgMock) ProtoMessage()

ProtoMessage calls ProtoMessageFunc.

func (*MsgMock) ProtoMessageCalls

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

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

len(mockedMsg.ProtoMessageCalls())

func (*MsgMock) Reset

func (mock *MsgMock) Reset()

Reset calls ResetFunc.

func (*MsgMock) ResetCalls

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

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

len(mockedMsg.ResetCalls())

func (*MsgMock) String

func (mock *MsgMock) String() string

String calls StringFunc.

func (*MsgMock) StringCalls

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

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

len(mockedMsg.StringCalls())

func (*MsgMock) ValidateBasic

func (mock *MsgMock) ValidateBasic() error

ValidateBasic calls ValidateBasicFunc.

func (*MsgMock) ValidateBasicCalls

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

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

len(mockedMsg.ValidateBasicCalls())

type PermissionMock

type PermissionMock struct {
	// GetRoleFunc mocks the GetRole method.
	GetRoleFunc func(ctx sdk.Context, address sdk.AccAddress) permission.Role
	// contains filtered or unexported fields
}

PermissionMock is a mock implementation of types.Permission.

func TestSomethingThatUsesPermission(t *testing.T) {

	// make and configure a mocked types.Permission
	mockedPermission := &PermissionMock{
		GetRoleFunc: func(ctx sdk.Context, address sdk.AccAddress) permission.Role {
			panic("mock out the GetRole method")
		},
	}

	// use mockedPermission in code that requires types.Permission
	// and then make assertions.

}

func (*PermissionMock) GetRole

func (mock *PermissionMock) GetRole(ctx sdk.Context, address sdk.AccAddress) permission.Role

GetRole calls GetRoleFunc.

func (*PermissionMock) GetRoleCalls

func (mock *PermissionMock) GetRoleCalls() []struct {
	Ctx     sdk.Context
	Address sdk.AccAddress
}

GetRoleCalls gets all the calls that were made to GetRole. Check the length with:

len(mockedPermission.GetRoleCalls())

type StakingMock added in v0.21.0

type StakingMock struct {
	// ValidatorFunc mocks the Validator method.
	ValidatorFunc func(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI
	// contains filtered or unexported fields
}

StakingMock is a mock implementation of types.Staking.

func TestSomethingThatUsesStaking(t *testing.T) {

	// make and configure a mocked types.Staking
	mockedStaking := &StakingMock{
		ValidatorFunc: func(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI {
			panic("mock out the Validator method")
		},
	}

	// use mockedStaking in code that requires types.Staking
	// and then make assertions.

}

func (*StakingMock) Validator added in v0.21.0

func (mock *StakingMock) Validator(ctx sdk.Context, addr sdk.ValAddress) stakingtypes.ValidatorI

Validator calls ValidatorFunc.

func (*StakingMock) ValidatorCalls added in v0.21.0

func (mock *StakingMock) ValidatorCalls() []struct {
	Ctx  sdk.Context
	Addr sdk.ValAddress
}

ValidatorCalls gets all the calls that were made to Validator. Check the length with:

len(mockedStaking.ValidatorCalls())

type Tx

type Tx sdk.Tx

Tx alias for mocking

type TxMock

type TxMock struct {
	// GetMsgsFunc mocks the GetMsgs method.
	GetMsgsFunc func() []sdk.Msg

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

TxMock is a mock implementation of Tx.

func TestSomethingThatUsesTx(t *testing.T) {

	// make and configure a mocked Tx
	mockedTx := &TxMock{
		GetMsgsFunc: func() []sdk.Msg {
			panic("mock out the GetMsgs method")
		},
		ValidateBasicFunc: func() error {
			panic("mock out the ValidateBasic method")
		},
	}

	// use mockedTx in code that requires Tx
	// and then make assertions.

}

func (*TxMock) GetMsgs

func (mock *TxMock) GetMsgs() []sdk.Msg

GetMsgs calls GetMsgsFunc.

func (*TxMock) GetMsgsCalls

func (mock *TxMock) GetMsgsCalls() []struct {
}

GetMsgsCalls gets all the calls that were made to GetMsgs. Check the length with:

len(mockedTx.GetMsgsCalls())

func (*TxMock) ValidateBasic

func (mock *TxMock) ValidateBasic() error

ValidateBasic calls ValidateBasicFunc.

func (*TxMock) ValidateBasicCalls

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

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

len(mockedTx.ValidateBasicCalls())

Jump to

Keyboard shortcuts

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