mock

package
v1.1.66 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Facade

type Facade struct {
	ShouldErrorStart           bool
	ShouldErrorStop            bool
	TpsBenchmarkHandler        func() *statistics.TpsBenchmark
	GetHeartbeatsHandler       func() ([]data.PubKeyHeartbeat, error)
	BalanceHandler             func(string) (*big.Int, error)
	GetAccountHandler          func(address string) (state.UserAccountHandler, error)
	GetCodeCalled              func(state.AccountHandler) []byte
	GenerateTransactionHandler func(sender string, receiver string, value *big.Int, code string) (*transaction.Transaction, error)
	GetTransactionHandler      func(hash string, withResults bool) (*transaction.ApiTransactionResult, error)
	CreateTransactionHandler   func(nonce uint64, value string, receiver string, receiverUsername []byte, sender string, senderUsername []byte, gasPrice uint64,
		gasLimit uint64, data []byte, signatureHex string, chainID string, version uint32, options uint32) (*transaction.Transaction, []byte, error)
	ValidateTransactionHandler              func(tx *transaction.Transaction) error
	ValidateTransactionForSimulationHandler func(tx *transaction.Transaction, bypassSignature bool) error
	SendBulkTransactionsHandler             func(txs []*transaction.Transaction) (uint64, error)
	ExecuteSCQueryHandler                   func(query *process.SCQuery) (*vm.VMOutputApi, error)
	StatusMetricsHandler                    func() external.StatusMetricsHandler
	ValidatorStatisticsHandler              func() (map[string]*state.ValidatorApiResponse, error)
	ComputeTransactionGasLimitHandler       func(tx *transaction.Transaction) (*transaction.CostResponse, error)
	NodeConfigCalled                        func() map[string]interface{}
	GetQueryHandlerCalled                   func(name string) (debug.QueryHandler, error)
	GetValueForKeyCalled                    func(address string, key string) (string, error)
	GetPeerInfoCalled                       func(pid string) ([]core.QueryP2PPeerInfo, error)
	GetThrottlerForEndpointCalled           func(endpoint string) (core.Throttler, bool)
	GetUsernameCalled                       func(address string) (string, error)
	GetKeyValuePairsCalled                  func(address string) (map[string]string, error)
	SimulateTransactionExecutionHandler     func(tx *transaction.Transaction) (*transaction.SimulationResults, error)
	GetNumCheckpointsFromAccountStateCalled func() uint32
	GetNumCheckpointsFromPeerStateCalled    func() uint32
	GetESDTDataCalled                       func(address string, key string, nonce uint64) (*esdt.ESDigitalToken, error)
	GetAllESDTTokensCalled                  func(address string) (map[string]*esdt.ESDigitalToken, error)
	GetESDTsWithRoleCalled                  func(address string, role string) ([]string, error)
	GetNFTTokenIDsRegisteredByAddressCalled func(address string) ([]string, error)
	GetBlockByHashCalled                    func(hash string, withTxs bool) (*api.Block, error)
	GetBlockByNonceCalled                   func(nonce uint64, withTxs bool) (*api.Block, error)
	GetTotalStakedValueHandler              func() (*api.StakeValues, error)
	GetAllIssuedESDTsCalled                 func(tokenType string) ([]string, error)
	GetDirectStakedListHandler              func() ([]*api.DirectStakedValue, error)
	GetDelegatorsListHandler                func() ([]*api.Delegator, error)
}

Facade is the mock implementation of a node router handler

func (*Facade) ComputeTransactionGasLimit

func (f *Facade) ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)

ComputeTransactionGasLimit -

func (*Facade) CreateTransaction

func (f *Facade) CreateTransaction(
	nonce uint64,
	value string,
	receiver string,
	receiverUsername []byte,
	sender string,
	senderUsername []byte,
	gasPrice uint64,
	gasLimit uint64,
	data []byte,
	signatureHex string,
	chainID string,
	version uint32,
	options uint32,
) (*transaction.Transaction, []byte, error)

CreateTransaction is mock implementation of a handler's CreateTransaction method

func (*Facade) DecodeAddressPubkey

func (f *Facade) DecodeAddressPubkey(pk string) ([]byte, error)

DecodeAddressPubkey -

func (*Facade) EncodeAddressPubkey

func (f *Facade) EncodeAddressPubkey(pk []byte) (string, error)

EncodeAddressPubkey -

func (*Facade) ExecuteSCQuery

func (f *Facade) ExecuteSCQuery(query *process.SCQuery) (*vm.VMOutputApi, error)

ExecuteSCQuery is a mock implementation.

func (*Facade) GetAccount

func (f *Facade) GetAccount(address string) (state.UserAccountHandler, error)

GetAccount is the mock implementation of a handler's GetAccount method

func (*Facade) GetAllESDTTokens

func (f *Facade) GetAllESDTTokens(address string) (map[string]*esdt.ESDigitalToken, error)

GetAllESDTTokens -

func (*Facade) GetAllIssuedESDTs

func (f *Facade) GetAllIssuedESDTs(tokenType string) ([]string, error)

GetAllIssuedESDTs -

func (*Facade) GetBalance

func (f *Facade) GetBalance(address string) (*big.Int, error)

GetBalance is the mock implementation of a handler's GetBalance method

func (*Facade) GetBlockByHash

func (f *Facade) GetBlockByHash(hash string, withTxs bool) (*api.Block, error)

GetBlockByHash -

func (*Facade) GetBlockByNonce

func (f *Facade) GetBlockByNonce(nonce uint64, withTxs bool) (*api.Block, error)

GetBlockByNonce -

func (*Facade) GetCode

func (f *Facade) GetCode(account state.UserAccountHandler) []byte

GetCode -

func (*Facade) GetDelegatorsList

func (f *Facade) GetDelegatorsList() ([]*api.Delegator, error)

GetDelegatorsList -

func (*Facade) GetDirectStakedList

func (f *Facade) GetDirectStakedList() ([]*api.DirectStakedValue, error)

GetDirectStakedList -

func (*Facade) GetESDTData

func (f *Facade) GetESDTData(address string, key string, nonce uint64) (*esdt.ESDigitalToken, error)

GetESDTData -

func (*Facade) GetESDTsWithRole

func (f *Facade) GetESDTsWithRole(address string, role string) ([]string, error)

GetESDTsWithRole -

func (*Facade) GetHeartbeats

func (f *Facade) GetHeartbeats() ([]data.PubKeyHeartbeat, error)

GetHeartbeats returns the slice of heartbeat info

func (*Facade) GetKeyValuePairs

func (f *Facade) GetKeyValuePairs(address string) (map[string]string, error)

GetKeyValuePairs -

func (*Facade) GetNFTTokenIDsRegisteredByAddress

func (f *Facade) GetNFTTokenIDsRegisteredByAddress(address string) ([]string, error)

GetNFTTokenIDsRegisteredByAddress -

func (*Facade) GetNumCheckpointsFromAccountState

func (f *Facade) GetNumCheckpointsFromAccountState() uint32

GetNumCheckpointsFromAccountState -

func (*Facade) GetNumCheckpointsFromPeerState

func (f *Facade) GetNumCheckpointsFromPeerState() uint32

GetNumCheckpointsFromPeerState -

func (*Facade) GetPeerInfo

func (f *Facade) GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error)

GetPeerInfo -

func (*Facade) GetQueryHandler

func (f *Facade) GetQueryHandler(name string) (debug.QueryHandler, error)

GetQueryHandler -

func (*Facade) GetThrottlerForEndpoint

func (f *Facade) GetThrottlerForEndpoint(endpoint string) (core.Throttler, bool)

GetThrottlerForEndpoint -

func (*Facade) GetTotalStakedValue

func (f *Facade) GetTotalStakedValue() (*api.StakeValues, error)

GetTotalStakedValue -

func (*Facade) GetTransaction

func (f *Facade) GetTransaction(hash string, withResults bool) (*transaction.ApiTransactionResult, error)

GetTransaction is the mock implementation of a handler's GetTransaction method

func (*Facade) GetUsername

func (f *Facade) GetUsername(address string) (string, error)

GetUsername -

func (*Facade) GetValueForKey

func (f *Facade) GetValueForKey(address string, key string) (string, error)

GetValueForKey is the mock implementation of a handler's GetValueForKey method

func (*Facade) IsInterfaceNil

func (f *Facade) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Facade) NodeConfig

func (f *Facade) NodeConfig() map[string]interface{}

NodeConfig -

func (*Facade) PprofEnabled

func (f *Facade) PprofEnabled() bool

PprofEnabled -

func (*Facade) RestAPIServerDebugMode

func (f *Facade) RestAPIServerDebugMode() bool

RestAPIServerDebugMode -

func (*Facade) RestApiInterface

func (f *Facade) RestApiInterface() string

RestApiInterface -

func (*Facade) SendBulkTransactions

func (f *Facade) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

SendBulkTransactions is the mock implementation of a handler's SendBulkTransactions method

func (*Facade) SimulateTransactionExecution

func (f *Facade) SimulateTransactionExecution(tx *transaction.Transaction) (*transaction.SimulationResults, error)

SimulateTransactionExecution is the mock implementation of a handler's SimulateTransactionExecution method

func (*Facade) StatusMetrics

func (f *Facade) StatusMetrics() external.StatusMetricsHandler

StatusMetrics is the mock implementation for the StatusMetrics

func (*Facade) TpsBenchmark

func (f *Facade) TpsBenchmark() *statistics.TpsBenchmark

TpsBenchmark is the mock implementation for retreiving the TpsBenchmark

func (*Facade) ValidateTransaction

func (f *Facade) ValidateTransaction(tx *transaction.Transaction) error

ValidateTransaction -

func (*Facade) ValidateTransactionForSimulation

func (f *Facade) ValidateTransactionForSimulation(tx *transaction.Transaction, bypassSignature bool) error

ValidateTransactionForSimulation -

func (*Facade) ValidatorStatisticsApi

func (f *Facade) ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)

ValidatorStatisticsApi is the mock implementation of a handler's ValidatorStatisticsApi method

type HardforkFacade

type HardforkFacade struct {
	TriggerCalled       func(epoch uint32, withEarlyEndOfEpoch bool) error
	IsSelfTriggerCalled func() bool
}

HardforkFacade -

func (*HardforkFacade) IsInterfaceNil

func (hf *HardforkFacade) IsInterfaceNil() bool

IsInterfaceNil -

func (*HardforkFacade) IsSelfTrigger

func (hf *HardforkFacade) IsSelfTrigger() bool

IsSelfTrigger -

func (*HardforkFacade) Trigger

func (hf *HardforkFacade) Trigger(epoch uint32, withEarlyEndOfEpoch bool) error

Trigger -

type LoggerStub

type LoggerStub struct {
	LogCalled      func(level string, message string, args ...interface{})
	SetLevelCalled func(logLevel logger.LogLevel)
}

LoggerStub -

func (*LoggerStub) Debug

func (l *LoggerStub) Debug(message string, args ...interface{})

Debug -

func (*LoggerStub) Error

func (l *LoggerStub) Error(message string, args ...interface{})

Error -

func (*LoggerStub) GetLevel

func (l *LoggerStub) GetLevel() logger.LogLevel

GetLevel -

func (*LoggerStub) Info

func (l *LoggerStub) Info(message string, args ...interface{})

Info -

func (*LoggerStub) IsInterfaceNil

func (l *LoggerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*LoggerStub) Log

func (l *LoggerStub) Log(line *logger.LogLine)

Log -

func (*LoggerStub) LogIfError

func (l *LoggerStub) LogIfError(err error, args ...interface{})

LogIfError -

func (*LoggerStub) SetLevel

func (l *LoggerStub) SetLevel(logLevel logger.LogLevel)

SetLevel -

func (*LoggerStub) Trace

func (l *LoggerStub) Trace(message string, args ...interface{})

Trace -

func (*LoggerStub) Warn

func (l *LoggerStub) Warn(message string, args ...interface{})

Warn -

type MarshalizerStub

type MarshalizerStub struct {
	MarshalCalled   func(obj interface{}) ([]byte, error)
	UnmarshalCalled func(obj interface{}, buff []byte) error
}

MarshalizerStub -

func (*MarshalizerStub) IsInterfaceNil

func (ms *MarshalizerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*MarshalizerStub) Marshal

func (ms *MarshalizerStub) Marshal(obj interface{}) ([]byte, error)

Marshal -

func (*MarshalizerStub) Unmarshal

func (ms *MarshalizerStub) Unmarshal(obj interface{}, buff []byte) error

Unmarshal -

type QueryHandlerStub

type QueryHandlerStub struct {
	QueryCalled func(search string) []string
}

QueryHandlerStub -

func (*QueryHandlerStub) IsInterfaceNil

func (qhs *QueryHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*QueryHandlerStub) Query

func (qhs *QueryHandlerStub) Query(search string) []string

Query -

type ThrottlerStub

type ThrottlerStub struct {
	CanProcessCalled      func() bool
	StartProcessingCalled func()
	EndProcessingCalled   func()
	StartWasCalled        bool
	EndWasCalled          bool
}

ThrottlerStub -

func (*ThrottlerStub) CanProcess

func (ts *ThrottlerStub) CanProcess() bool

CanProcess -

func (*ThrottlerStub) EndProcessing

func (ts *ThrottlerStub) EndProcessing()

EndProcessing -

func (*ThrottlerStub) IsInterfaceNil

func (ts *ThrottlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ThrottlerStub) StartProcessing

func (ts *ThrottlerStub) StartProcessing()

StartProcessing -

type WrongFacade

type WrongFacade struct {
}

WrongFacade is a struct that can be used as a wrong implementation of the node router handler

type WsConnStub

type WsConnStub struct {
	// contains filtered or unexported fields
}

WsConnStub -

func (*WsConnStub) Close

func (wcs *WsConnStub) Close() error

Close -

func (*WsConnStub) ReadMessage

func (wcs *WsConnStub) ReadMessage() (messageType int, p []byte, err error)

ReadMessage -

func (*WsConnStub) SetCloseHandler

func (wcs *WsConnStub) SetCloseHandler(f func() error)

SetCloseHandler -

func (*WsConnStub) SetReadMessageHandler

func (wcs *WsConnStub) SetReadMessageHandler(f func() (messageType int, p []byte, err error))

SetReadMessageHandler -

func (*WsConnStub) SetWriteMessageHandler

func (wcs *WsConnStub) SetWriteMessageHandler(f func(messageType int, data []byte) error)

SetWriteMessageHandler -

func (*WsConnStub) WriteMessage

func (wcs *WsConnStub) WriteMessage(messageType int, data []byte) error

WriteMessage -

Jump to

Keyboard shortcuts

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