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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeeperMock

type KeeperMock struct {
	// DeleteKeygenSessionFunc mocks the DeleteKeygenSession method.
	DeleteKeygenSessionFunc func(ctx sdk.Context, id github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID)

	// DeleteSigningSessionFunc mocks the DeleteSigningSession method.
	DeleteSigningSessionFunc func(ctx sdk.Context, id uint64)

	// GetCurrentKeyIDFunc mocks the GetCurrentKeyID method.
	GetCurrentKeyIDFunc func(ctx sdk.Context, chainName github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID, bool)

	// GetKeyFunc mocks the GetKey method.
	GetKeyFunc func(ctx sdk.Context, keyID github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID) (github_com_axelarnetwork_axelar_core_x_multisig_exported.Key, bool)

	// GetKeygenSessionFunc mocks the GetKeygenSession method.
	GetKeygenSessionFunc func(ctx sdk.Context, id github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID) (types.KeygenSession, bool)

	// GetKeygenSessionsByExpiryFunc mocks the GetKeygenSessionsByExpiry method.
	GetKeygenSessionsByExpiryFunc func(ctx sdk.Context, expiry int64) []types.KeygenSession

	// GetNextKeyIDFunc mocks the GetNextKeyID method.
	GetNextKeyIDFunc func(ctx sdk.Context, chainName github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID, bool)

	// GetParamsFunc mocks the GetParams method.
	GetParamsFunc func(ctx sdk.Context) types.Params

	// GetSigRouterFunc mocks the GetSigRouter method.
	GetSigRouterFunc func() types.SigRouter

	// GetSigningSessionsByExpiryFunc mocks the GetSigningSessionsByExpiry method.
	GetSigningSessionsByExpiryFunc func(ctx sdk.Context, expiry int64) []types.SigningSession

	// LoggerFunc mocks the Logger method.
	LoggerFunc func(ctx sdk.Context) log.Logger

	// SetKeyFunc mocks the SetKey method.
	SetKeyFunc func(ctx sdk.Context, key types.Key)
	// contains filtered or unexported fields
}

KeeperMock is a mock implementation of types.Keeper.

func TestSomethingThatUsesKeeper(t *testing.T) {

	// make and configure a mocked types.Keeper
	mockedKeeper := &KeeperMock{
		DeleteKeygenSessionFunc: func(ctx sdk.Context, id github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID)  {
			panic("mock out the DeleteKeygenSession method")
		},
		DeleteSigningSessionFunc: func(ctx sdk.Context, id uint64)  {
			panic("mock out the DeleteSigningSession method")
		},
		GetCurrentKeyIDFunc: func(ctx sdk.Context, chainName github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID, bool) {
			panic("mock out the GetCurrentKeyID method")
		},
		GetKeyFunc: func(ctx sdk.Context, keyID github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID) (github_com_axelarnetwork_axelar_core_x_multisig_exported.Key, bool) {
			panic("mock out the GetKey method")
		},
		GetKeygenSessionFunc: func(ctx sdk.Context, id github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID) (types.KeygenSession, bool) {
			panic("mock out the GetKeygenSession method")
		},
		GetKeygenSessionsByExpiryFunc: func(ctx sdk.Context, expiry int64) []types.KeygenSession {
			panic("mock out the GetKeygenSessionsByExpiry method")
		},
		GetNextKeyIDFunc: func(ctx sdk.Context, chainName github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID, bool) {
			panic("mock out the GetNextKeyID method")
		},
		GetParamsFunc: func(ctx sdk.Context) types.Params {
			panic("mock out the GetParams method")
		},
		GetSigRouterFunc: func() types.SigRouter {
			panic("mock out the GetSigRouter method")
		},
		GetSigningSessionsByExpiryFunc: func(ctx sdk.Context, expiry int64) []types.SigningSession {
			panic("mock out the GetSigningSessionsByExpiry method")
		},
		LoggerFunc: func(ctx sdk.Context) log.Logger {
			panic("mock out the Logger method")
		},
		SetKeyFunc: func(ctx sdk.Context, key types.Key)  {
			panic("mock out the SetKey method")
		},
	}

	// use mockedKeeper in code that requires types.Keeper
	// and then make assertions.

}

func (*KeeperMock) DeleteKeygenSession

DeleteKeygenSession calls DeleteKeygenSessionFunc.

func (*KeeperMock) DeleteKeygenSessionCalls

func (mock *KeeperMock) DeleteKeygenSessionCalls() []struct {
	Ctx sdk.Context
	ID  github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID
}

DeleteKeygenSessionCalls gets all the calls that were made to DeleteKeygenSession. Check the length with:

len(mockedKeeper.DeleteKeygenSessionCalls())

func (*KeeperMock) DeleteSigningSession

func (mock *KeeperMock) DeleteSigningSession(ctx sdk.Context, id uint64)

DeleteSigningSession calls DeleteSigningSessionFunc.

func (*KeeperMock) DeleteSigningSessionCalls

func (mock *KeeperMock) DeleteSigningSessionCalls() []struct {
	Ctx sdk.Context
	ID  uint64
}

DeleteSigningSessionCalls gets all the calls that were made to DeleteSigningSession. Check the length with:

len(mockedKeeper.DeleteSigningSessionCalls())

func (*KeeperMock) GetCurrentKeyID

GetCurrentKeyID calls GetCurrentKeyIDFunc.

func (*KeeperMock) GetCurrentKeyIDCalls

func (mock *KeeperMock) GetCurrentKeyIDCalls() []struct {
	Ctx       sdk.Context
	ChainName github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName
}

GetCurrentKeyIDCalls gets all the calls that were made to GetCurrentKeyID. Check the length with:

len(mockedKeeper.GetCurrentKeyIDCalls())

func (*KeeperMock) GetKeyCalls

func (mock *KeeperMock) GetKeyCalls() []struct {
	Ctx   sdk.Context
	KeyID github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID
}

GetKeyCalls gets all the calls that were made to GetKey. Check the length with:

len(mockedKeeper.GetKeyCalls())

func (*KeeperMock) GetKeygenSession added in v0.21.1

GetKeygenSession calls GetKeygenSessionFunc.

func (*KeeperMock) GetKeygenSessionCalls added in v0.21.1

func (mock *KeeperMock) GetKeygenSessionCalls() []struct {
	Ctx sdk.Context
	ID  github_com_axelarnetwork_axelar_core_x_multisig_exported.KeyID
}

GetKeygenSessionCalls gets all the calls that were made to GetKeygenSession. Check the length with:

len(mockedKeeper.GetKeygenSessionCalls())

func (*KeeperMock) GetKeygenSessionsByExpiry

func (mock *KeeperMock) GetKeygenSessionsByExpiry(ctx sdk.Context, expiry int64) []types.KeygenSession

GetKeygenSessionsByExpiry calls GetKeygenSessionsByExpiryFunc.

func (*KeeperMock) GetKeygenSessionsByExpiryCalls

func (mock *KeeperMock) GetKeygenSessionsByExpiryCalls() []struct {
	Ctx    sdk.Context
	Expiry int64
}

GetKeygenSessionsByExpiryCalls gets all the calls that were made to GetKeygenSessionsByExpiry. Check the length with:

len(mockedKeeper.GetKeygenSessionsByExpiryCalls())

func (*KeeperMock) GetNextKeyID

GetNextKeyID calls GetNextKeyIDFunc.

func (*KeeperMock) GetNextKeyIDCalls

func (mock *KeeperMock) GetNextKeyIDCalls() []struct {
	Ctx       sdk.Context
	ChainName github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName
}

GetNextKeyIDCalls gets all the calls that were made to GetNextKeyID. Check the length with:

len(mockedKeeper.GetNextKeyIDCalls())

func (*KeeperMock) GetParams added in v0.34.0

func (mock *KeeperMock) GetParams(ctx sdk.Context) types.Params

GetParams calls GetParamsFunc.

func (*KeeperMock) GetParamsCalls added in v0.34.0

func (mock *KeeperMock) GetParamsCalls() []struct {
	Ctx sdk.Context
}

GetParamsCalls gets all the calls that were made to GetParams. Check the length with:

len(mockedKeeper.GetParamsCalls())

func (*KeeperMock) GetSigRouter

func (mock *KeeperMock) GetSigRouter() types.SigRouter

GetSigRouter calls GetSigRouterFunc.

func (*KeeperMock) GetSigRouterCalls

func (mock *KeeperMock) GetSigRouterCalls() []struct {
}

GetSigRouterCalls gets all the calls that were made to GetSigRouter. Check the length with:

len(mockedKeeper.GetSigRouterCalls())

func (*KeeperMock) GetSigningSessionsByExpiry

func (mock *KeeperMock) GetSigningSessionsByExpiry(ctx sdk.Context, expiry int64) []types.SigningSession

GetSigningSessionsByExpiry calls GetSigningSessionsByExpiryFunc.

func (*KeeperMock) GetSigningSessionsByExpiryCalls

func (mock *KeeperMock) GetSigningSessionsByExpiryCalls() []struct {
	Ctx    sdk.Context
	Expiry int64
}

GetSigningSessionsByExpiryCalls gets all the calls that were made to GetSigningSessionsByExpiry. Check the length with:

len(mockedKeeper.GetSigningSessionsByExpiryCalls())

func (*KeeperMock) Logger

func (mock *KeeperMock) Logger(ctx sdk.Context) log.Logger

Logger calls LoggerFunc.

func (*KeeperMock) LoggerCalls

func (mock *KeeperMock) LoggerCalls() []struct {
	Ctx sdk.Context
}

LoggerCalls gets all the calls that were made to Logger. Check the length with:

len(mockedKeeper.LoggerCalls())

func (*KeeperMock) SetKey

func (mock *KeeperMock) SetKey(ctx sdk.Context, key types.Key)

SetKey calls SetKeyFunc.

func (*KeeperMock) SetKeyCalls

func (mock *KeeperMock) SetKeyCalls() []struct {
	Ctx sdk.Context
	Key types.Key
}

SetKeyCalls gets all the calls that were made to SetKey. Check the length with:

len(mockedKeeper.SetKeyCalls())

type KeygenParticipatorMock added in v0.27.0

type KeygenParticipatorMock struct {
	// HasOptedOutFunc mocks the HasOptedOut method.
	HasOptedOutFunc func(ctx sdk.Context, participant sdk.AccAddress) bool
	// contains filtered or unexported fields
}

KeygenParticipatorMock is a mock implementation of types.KeygenParticipator.

func TestSomethingThatUsesKeygenParticipator(t *testing.T) {

	// make and configure a mocked types.KeygenParticipator
	mockedKeygenParticipator := &KeygenParticipatorMock{
		HasOptedOutFunc: func(ctx sdk.Context, participant sdk.AccAddress) bool {
			panic("mock out the HasOptedOut method")
		},
	}

	// use mockedKeygenParticipator in code that requires types.KeygenParticipator
	// and then make assertions.

}

func (*KeygenParticipatorMock) HasOptedOut added in v0.27.0

func (mock *KeygenParticipatorMock) HasOptedOut(ctx sdk.Context, participant sdk.AccAddress) bool

HasOptedOut calls HasOptedOutFunc.

func (*KeygenParticipatorMock) HasOptedOutCalls added in v0.27.0

func (mock *KeygenParticipatorMock) HasOptedOutCalls() []struct {
	Ctx         sdk.Context
	Participant sdk.AccAddress
}

HasOptedOutCalls gets all the calls that were made to HasOptedOut. Check the length with:

len(mockedKeygenParticipator.HasOptedOutCalls())

type NexusMock

type NexusMock struct {
	// GetChainFunc mocks the GetChain method.
	GetChainFunc func(ctx sdk.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, bool)

	// GetChainsFunc mocks the GetChains method.
	GetChainsFunc func(ctx sdk.Context) []github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain
	// contains filtered or unexported fields
}

NexusMock is a mock implementation of types.Nexus.

func TestSomethingThatUsesNexus(t *testing.T) {

	// make and configure a mocked types.Nexus
	mockedNexus := &NexusMock{
		GetChainFunc: func(ctx sdk.Context, chain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName) (github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain, bool) {
			panic("mock out the GetChain method")
		},
		GetChainsFunc: func(ctx sdk.Context) []github_com_axelarnetwork_axelar_core_x_nexus_exported.Chain {
			panic("mock out the GetChains method")
		},
	}

	// use mockedNexus in code that requires types.Nexus
	// and then make assertions.

}

func (*NexusMock) GetChainCalls

func (mock *NexusMock) GetChainCalls() []struct {
	Ctx   sdk.Context
	Chain github_com_axelarnetwork_axelar_core_x_nexus_exported.ChainName
}

GetChainCalls gets all the calls that were made to GetChain. Check the length with:

len(mockedNexus.GetChainCalls())

func (*NexusMock) GetChains added in v0.22.0

GetChains calls GetChainsFunc.

func (*NexusMock) GetChainsCalls added in v0.22.0

func (mock *NexusMock) GetChainsCalls() []struct {
	Ctx sdk.Context
}

GetChainsCalls gets all the calls that were made to GetChains. Check the length with:

len(mockedNexus.GetChainsCalls())

type RewarderMock

type RewarderMock struct {
	// GetPoolFunc mocks the GetPool method.
	GetPoolFunc func(ctx sdk.Context, name string) reward.RewardPool
	// contains filtered or unexported fields
}

RewarderMock is a mock implementation of types.Rewarder.

func TestSomethingThatUsesRewarder(t *testing.T) {

	// make and configure a mocked types.Rewarder
	mockedRewarder := &RewarderMock{
		GetPoolFunc: func(ctx sdk.Context, name string) reward.RewardPool {
			panic("mock out the GetPool method")
		},
	}

	// use mockedRewarder in code that requires types.Rewarder
	// and then make assertions.

}

func (*RewarderMock) GetPool

func (mock *RewarderMock) GetPool(ctx sdk.Context, name string) reward.RewardPool

GetPool calls GetPoolFunc.

func (*RewarderMock) GetPoolCalls

func (mock *RewarderMock) GetPoolCalls() []struct {
	Ctx  sdk.Context
	Name string
}

GetPoolCalls gets all the calls that were made to GetPool. Check the length with:

len(mockedRewarder.GetPoolCalls())

type SlasherMock

type SlasherMock struct {
	// IsTombstonedFunc mocks the IsTombstoned method.
	IsTombstonedFunc func(ctx sdk.Context, consAddr sdk.ConsAddress) bool
	// contains filtered or unexported fields
}

SlasherMock is a mock implementation of types.Slasher.

func TestSomethingThatUsesSlasher(t *testing.T) {

	// make and configure a mocked types.Slasher
	mockedSlasher := &SlasherMock{
		IsTombstonedFunc: func(ctx sdk.Context, consAddr sdk.ConsAddress) bool {
			panic("mock out the IsTombstoned method")
		},
	}

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

}

func (*SlasherMock) IsTombstoned

func (mock *SlasherMock) IsTombstoned(ctx sdk.Context, consAddr sdk.ConsAddress) bool

IsTombstoned calls IsTombstonedFunc.

func (*SlasherMock) IsTombstonedCalls

func (mock *SlasherMock) IsTombstonedCalls() []struct {
	Ctx      sdk.Context
	ConsAddr sdk.ConsAddress
}

IsTombstonedCalls gets all the calls that were made to IsTombstoned. Check the length with:

len(mockedSlasher.IsTombstonedCalls())

type SnapshotterMock

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

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

	// GetProxyFunc mocks the GetProxy method.
	GetProxyFunc func(ctx sdk.Context, operator sdk.ValAddress) (sdk.AccAddress, bool)
	// contains filtered or unexported fields
}

SnapshotterMock is a mock implementation of types.Snapshotter.

func TestSomethingThatUsesSnapshotter(t *testing.T) {

	// make and configure a mocked types.Snapshotter
	mockedSnapshotter := &SnapshotterMock{
		CreateSnapshotFunc: func(ctx sdk.Context, candidates []sdk.ValAddress, filterFunc func(exported.ValidatorI) bool, weightFunc func(consensusPower sdk.Uint) sdk.Uint, threshold utils.Threshold) (exported.Snapshot, error) {
			panic("mock out the CreateSnapshot method")
		},
		GetOperatorFunc: func(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress {
			panic("mock out the GetOperator method")
		},
		GetProxyFunc: func(ctx sdk.Context, operator sdk.ValAddress) (sdk.AccAddress, bool) {
			panic("mock out the GetProxy method")
		},
	}

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

}

func (*SnapshotterMock) CreateSnapshot

func (mock *SnapshotterMock) CreateSnapshot(ctx sdk.Context, candidates []sdk.ValAddress, filterFunc func(exported.ValidatorI) bool, weightFunc func(consensusPower sdk.Uint) sdk.Uint, threshold utils.Threshold) (exported.Snapshot, error)

CreateSnapshot calls CreateSnapshotFunc.

func (*SnapshotterMock) CreateSnapshotCalls

func (mock *SnapshotterMock) CreateSnapshotCalls() []struct {
	Ctx        sdk.Context
	Candidates []sdk.ValAddress
	FilterFunc func(exported.ValidatorI) bool
	WeightFunc func(consensusPower sdk.Uint) sdk.Uint
	Threshold  utils.Threshold
}

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

len(mockedSnapshotter.CreateSnapshotCalls())

func (*SnapshotterMock) GetOperator

func (mock *SnapshotterMock) GetOperator(ctx sdk.Context, proxy sdk.AccAddress) sdk.ValAddress

GetOperator calls GetOperatorFunc.

func (*SnapshotterMock) GetOperatorCalls

func (mock *SnapshotterMock) GetOperatorCalls() []struct {
	Ctx   sdk.Context
	Proxy sdk.AccAddress
}

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

len(mockedSnapshotter.GetOperatorCalls())

func (*SnapshotterMock) GetProxy

func (mock *SnapshotterMock) GetProxy(ctx sdk.Context, operator sdk.ValAddress) (sdk.AccAddress, bool)

GetProxy calls GetProxyFunc.

func (*SnapshotterMock) GetProxyCalls

func (mock *SnapshotterMock) GetProxyCalls() []struct {
	Ctx      sdk.Context
	Operator sdk.ValAddress
}

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

len(mockedSnapshotter.GetProxyCalls())

type StakerMock

type StakerMock struct {
	// GetBondedValidatorsByPowerFunc mocks the GetBondedValidatorsByPower method.
	GetBondedValidatorsByPowerFunc func(ctx sdk.Context) []stakingTypes.Validator
	// contains filtered or unexported fields
}

StakerMock is a mock implementation of types.Staker.

func TestSomethingThatUsesStaker(t *testing.T) {

	// make and configure a mocked types.Staker
	mockedStaker := &StakerMock{
		GetBondedValidatorsByPowerFunc: func(ctx sdk.Context) []stakingTypes.Validator {
			panic("mock out the GetBondedValidatorsByPower method")
		},
	}

	// use mockedStaker in code that requires types.Staker
	// and then make assertions.

}

func (*StakerMock) GetBondedValidatorsByPower

func (mock *StakerMock) GetBondedValidatorsByPower(ctx sdk.Context) []stakingTypes.Validator

GetBondedValidatorsByPower calls GetBondedValidatorsByPowerFunc.

func (*StakerMock) GetBondedValidatorsByPowerCalls

func (mock *StakerMock) GetBondedValidatorsByPowerCalls() []struct {
	Ctx sdk.Context
}

GetBondedValidatorsByPowerCalls gets all the calls that were made to GetBondedValidatorsByPower. Check the length with:

len(mockedStaker.GetBondedValidatorsByPowerCalls())

Jump to

Keyboard shortcuts

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