mock

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppGenState

func AppGenState(_ *codec.Codec, _ types.GenesisDoc, _ []json.RawMessage) (appState json.
	RawMessage, err error)

AppGenState can be passed into InitCmd, returns a static string of a few key-values that can be parsed by InitChainer

func AppGenStateEmpty

func AppGenStateEmpty(_ *codec.Codec, _ types.GenesisDoc, _ []json.RawMessage) (
	appState json.RawMessage, err error)

AppGenStateEmpty returns an empty transaction state for mocking.

func InitChainer

InitChainer returns a function that can initialize the chain with key/value pairs

func KVStoreHandler

func KVStoreHandler(storeKey sdk.StoreKey) sdk.Handler

KVStoreHandler is a simple handler that takes kvstoreTx and writes them to the db

func NewApp

func NewApp(rootDir string, logger log.Logger) (abci.Application, error)

NewApp creates a simple mock kvstore app for testing. It should work similar to a real app. Make sure rootDir is empty before running the test, in order to guarantee consistent results

func NewCommitMultiStore

func NewCommitMultiStore() sdk.CommitMultiStore

func NewTx

func NewTx(key, value string) kvstoreTx

func SetupApp

func SetupApp() (abci.Application, func(), error)

SetupApp returns an application as well as a clean-up function to be used to quickly setup a test case with an app

Types

type GenesisJSON

type GenesisJSON struct {
	Values []KV `json:"values"`
}

What Genesis JSON is formatted as

type KV

type KV struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

basic KV structure

Jump to

Keyboard shortcuts

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