mock

package
v1.0.29 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: GPL-3.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 ApiResolverStub

type ApiResolverStub struct {
	GetVmValueHandler    func(address string, funcName string, argsBuff ...[]byte) ([]byte, error)
	StatusMetricsHandler func() external.StatusMetricsHandler
}

func (*ApiResolverStub) GetVmValue added in v1.0.11

func (ars *ApiResolverStub) GetVmValue(address string, funcName string, argsBuff ...[]byte) ([]byte, error)

func (*ApiResolverStub) IsInterfaceNil

func (ars *ApiResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ApiResolverStub) StatusMetrics

func (ars *ApiResolverStub) StatusMetrics() external.StatusMetricsHandler

type NodeMock

type NodeMock struct {
	AddressHandler             func() (string, error)
	StartHandler               func() error
	StopHandler                func() error
	P2PBootstrapHandler        func() error
	IsRunningHandler           func() bool
	ConnectToAddressesHandler  func([]string) error
	StartConsensusHandler      func() error
	GetBalanceHandler          func(address string) (*big.Int, error)
	GenerateTransactionHandler func(sender string, receiver string, amount *big.Int, code string) (*transaction.Transaction, error)
	CreateTransactionHandler   func(nonce uint64, value *big.Int, receiverHex string, senderHex string, gasPrice uint64,
		gasLimit uint64, data string, signatureHex string, challenge string) (*transaction.Transaction, error)
	GetTransactionHandler                          func(hash string) (*transaction.Transaction, error)
	SendTransactionHandler                         func(nonce uint64, sender string, receiver string, amount *big.Int, code string, signature []byte) (string, error)
	SendBulkTransactionsHandler                    func(txs []*transaction.Transaction) (uint64, error)
	GetAccountHandler                              func(address string) (*state.Account, error)
	GetCurrentPublicKeyHandler                     func() string
	GenerateAndSendBulkTransactionsHandler         func(destination string, value *big.Int, nrTransactions uint64) error
	GenerateAndSendBulkTransactionsOneByOneHandler func(destination string, value *big.Int, nrTransactions uint64) error
	GetHeartbeatsHandler                           func() []heartbeat.PubKeyHeartbeat
}

func (*NodeMock) Address

func (nm *NodeMock) Address() (string, error)

func (*NodeMock) ConnectToAddresses

func (nm *NodeMock) ConnectToAddresses(addresses []string) error

func (*NodeMock) CreateTransaction

func (nm *NodeMock) CreateTransaction(nonce uint64, value *big.Int, receiverHex string, senderHex string, gasPrice uint64,
	gasLimit uint64, data string, signatureHex string, challenge string) (*transaction.Transaction, error)

func (*NodeMock) GenerateAndSendBulkTransactions

func (nm *NodeMock) GenerateAndSendBulkTransactions(receiverHex string, value *big.Int, noOfTx uint64) error

func (*NodeMock) GenerateAndSendBulkTransactionsOneByOne

func (nm *NodeMock) GenerateAndSendBulkTransactionsOneByOne(receiverHex string, value *big.Int, noOfTx uint64) error

func (*NodeMock) GenerateTransaction

func (nm *NodeMock) GenerateTransaction(sender string, receiver string, amount *big.Int, code string) (*transaction.Transaction, error)

func (*NodeMock) GetAccount

func (nm *NodeMock) GetAccount(address string) (*state.Account, error)

func (*NodeMock) GetBalance

func (nm *NodeMock) GetBalance(address string) (*big.Int, error)

func (*NodeMock) GetCurrentPublicKey

func (nm *NodeMock) GetCurrentPublicKey() string

func (*NodeMock) GetHeartbeats

func (nm *NodeMock) GetHeartbeats() []heartbeat.PubKeyHeartbeat

func (*NodeMock) GetTransaction

func (nm *NodeMock) GetTransaction(hash string) (*transaction.Transaction, error)

func (*NodeMock) IsInterfaceNil

func (nm *NodeMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*NodeMock) IsRunning

func (nm *NodeMock) IsRunning() bool

func (*NodeMock) P2PBootstrap

func (nm *NodeMock) P2PBootstrap() error

func (*NodeMock) SendBulkTransactions

func (nm *NodeMock) SendBulkTransactions(txs []*transaction.Transaction) (uint64, error)

func (*NodeMock) SendTransaction added in v1.0.3

func (nm *NodeMock) SendTransaction(nonce uint64, sender string, receiver string, value *big.Int, gasPrice uint64, gasLimit uint64, transactionData string, signature []byte) (string, error)

func (*NodeMock) Start

func (nm *NodeMock) Start() error

func (*NodeMock) StartConsensus

func (nm *NodeMock) StartConsensus() error

func (*NodeMock) Stop added in v1.0.3

func (nm *NodeMock) Stop() error

type SyncTimerMock

type SyncTimerMock struct {
	StartSyncCalled            func()
	ClockOffsetCalled          func() time.Duration
	FormattedCurrentTimeCalled func() string
	CurrentTimeCalled          func() time.Time
}

SyncTimerMock is a mock implementation of SyncTimer interface

func (*SyncTimerMock) ClockOffset

func (s *SyncTimerMock) ClockOffset() time.Duration

ClockOffset is a mock implementation for ClockOffset

func (*SyncTimerMock) CurrentTime

func (s *SyncTimerMock) CurrentTime() time.Time

CurrentTime is a mock implementation for CurrentTime

func (*SyncTimerMock) FormattedCurrentTime

func (s *SyncTimerMock) FormattedCurrentTime() string

FormattedCurrentTime is a mock implementation for FormattedCurrentTime

func (*SyncTimerMock) IsInterfaceNil

func (stm *SyncTimerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*SyncTimerMock) StartSync

func (s *SyncTimerMock) StartSync()

StartSync is a mock implementation for StartSync

Jump to

Keyboard shortcuts

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