tendermint: github.com/tendermint/tendermint/rpc/client/mock Index | Files

package mock

import "github.com/tendermint/tendermint/rpc/client/mock"

Index

Package Files

abci.go client.go status.go

type ABCIApp Uses

type ABCIApp struct {
    App abci.Application
}

ABCIApp will send all abci related request to the named app, so you can test app behavior from a client without needing an entire tendermint node

func (ABCIApp) ABCIInfo Uses

func (a ABCIApp) ABCIInfo() (*ctypes.ResultABCIInfo, error)

func (ABCIApp) ABCIQuery Uses

func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)

func (ABCIApp) ABCIQueryWithOptions Uses

func (a ABCIApp) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (ABCIApp) BroadcastTxAsync Uses

func (a ABCIApp) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (ABCIApp) BroadcastTxCommit Uses

func (a ABCIApp) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

NOTE: Caller should call a.App.Commit() separately, this function does not actually wait for a commit. TODO: Make it wait for a commit and set res.Height appropriately.

func (ABCIApp) BroadcastTxSync Uses

func (a ABCIApp) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

type ABCIMock Uses

type ABCIMock struct {
    Info            Call
    Query           Call
    BroadcastCommit Call
    Broadcast       Call
}

ABCIMock will send all abci related request to the named app, so you can test app behavior from a client without needing an entire tendermint node

func (ABCIMock) ABCIInfo Uses

func (m ABCIMock) ABCIInfo() (*ctypes.ResultABCIInfo, error)

func (ABCIMock) ABCIQuery Uses

func (m ABCIMock) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)

func (ABCIMock) ABCIQueryWithOptions Uses

func (m ABCIMock) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (ABCIMock) BroadcastTxAsync Uses

func (m ABCIMock) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (ABCIMock) BroadcastTxCommit Uses

func (m ABCIMock) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

func (ABCIMock) BroadcastTxSync Uses

func (m ABCIMock) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

type ABCIRecorder Uses

type ABCIRecorder struct {
    Client client.ABCIClient
    Calls  []Call
}

ABCIRecorder can wrap another type (ABCIApp, ABCIMock, or Client) and record all ABCI related calls.

func NewABCIRecorder Uses

func NewABCIRecorder(client client.ABCIClient) *ABCIRecorder

func (*ABCIRecorder) ABCIInfo Uses

func (r *ABCIRecorder) ABCIInfo() (*ctypes.ResultABCIInfo, error)

func (*ABCIRecorder) ABCIQuery Uses

func (r *ABCIRecorder) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)

func (*ABCIRecorder) ABCIQueryWithOptions Uses

func (r *ABCIRecorder) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (*ABCIRecorder) BroadcastTxAsync Uses

func (r *ABCIRecorder) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (*ABCIRecorder) BroadcastTxCommit Uses

func (r *ABCIRecorder) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

func (*ABCIRecorder) BroadcastTxSync Uses

func (r *ABCIRecorder) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

type Call Uses

type Call struct {
    Name     string
    Args     interface{}
    Response interface{}
    Error    error
}

Call is used by recorders to save a call and response. It can also be used to configure mock responses.

func (Call) GetResponse Uses

func (c Call) GetResponse(args interface{}) (interface{}, error)

GetResponse will generate the apporiate response for us, when using the Call struct to configure a Mock handler.

When configuring a response, if only one of Response or Error is set then that will always be returned. If both are set, then we return Response if the Args match the set args, Error otherwise.

type Client Uses

type Client struct {
    client.ABCIClient
    client.SignClient
    client.HistoryClient
    client.StatusClient
    client.EventsClient
    cmn.Service
}

Client wraps arbitrary implementations of the various interfaces.

We provide a few choices to mock out each one in this package. Nothing hidden here, so no New function, just construct it from some parts, and swap them out them during the tests.

func (Client) ABCIInfo Uses

func (c Client) ABCIInfo() (*ctypes.ResultABCIInfo, error)

func (Client) ABCIQuery Uses

func (c Client) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error)

func (Client) ABCIQueryWithOptions Uses

func (c Client) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error)

func (Client) Block Uses

func (c Client) Block(height *int64) (*ctypes.ResultBlock, error)

func (Client) BlockchainInfo Uses

func (c Client) BlockchainInfo(minHeight, maxHeight int64) (*ctypes.ResultBlockchainInfo, error)

func (Client) BroadcastTxAsync Uses

func (c Client) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (Client) BroadcastTxCommit Uses

func (c Client) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

func (Client) BroadcastTxSync Uses

func (c Client) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

func (Client) Commit Uses

func (c Client) Commit(height *int64) (*ctypes.ResultCommit, error)

func (Client) ConsensusState Uses

func (c Client) ConsensusState() (*ctypes.ResultConsensusState, error)

func (Client) DialPeers Uses

func (c Client) DialPeers(peers []string, persistent bool) (*ctypes.ResultDialPeers, error)

func (Client) DialSeeds Uses

func (c Client) DialSeeds(seeds []string) (*ctypes.ResultDialSeeds, error)

func (Client) DumpConsensusState Uses

func (c Client) DumpConsensusState() (*ctypes.ResultDumpConsensusState, error)

func (Client) Genesis Uses

func (c Client) Genesis() (*ctypes.ResultGenesis, error)

func (Client) Health Uses

func (c Client) Health() (*ctypes.ResultHealth, error)

func (Client) NetInfo Uses

func (c Client) NetInfo() (*ctypes.ResultNetInfo, error)

func (Client) Status Uses

func (c Client) Status() (*ctypes.ResultStatus, error)

func (Client) Validators Uses

func (c Client) Validators(height *int64) (*ctypes.ResultValidators, error)

type QueryArgs Uses

type QueryArgs struct {
    Path   string
    Data   cmn.HexBytes
    Height int64
    Prove  bool
}

type StatusMock Uses

type StatusMock struct {
    Call
}

StatusMock returns the result specified by the Call

func (*StatusMock) Status Uses

func (m *StatusMock) Status() (*ctypes.ResultStatus, error)

type StatusRecorder Uses

type StatusRecorder struct {
    Client client.StatusClient
    Calls  []Call
}

StatusRecorder can wrap another type (StatusMock, full client) and record the status calls

func NewStatusRecorder Uses

func NewStatusRecorder(client client.StatusClient) *StatusRecorder

func (*StatusRecorder) Status Uses

func (r *StatusRecorder) Status() (*ctypes.ResultStatus, error)

Package mock imports 9 packages (graph). Updated 2019-03-29. Refresh now. Tools for package owners.