test_helpers

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestDenomination = sdk.DefaultBondDenom
	SimAppChainID    = "simulation-app"

	TestDefaultStorage = 200
	TestMaxStorage     = 300
)

SimAppChainID hardcoded chainID for simulation

Variables

View Source
var (
	DefaultConsensusParams = &abci.ConsensusParams{
		Block: &abci.BlockParams{
			MaxBytes: 200000,
			MaxGas:   2000000,
		},
		Evidence: &tmproto.EvidenceParams{
			MaxAgeNumBlocks: 302400,
			MaxAgeDuration:  504 * time.Hour,
			MaxBytes:        10000,
		},
		Validator: &tmproto.ValidatorParams{
			PubKeyTypes: []string{
				tmtypes.ABCIPubKeyTypeEd25519,
			},
		},
	}
	EncodingConfig = params.EncodingConfig{}
)

DefaultConsensusParams defines the default Tendermint consensus params used in app.App testing.

Functions

func AddTestAddrs

func AddTestAddrs(app *app.App, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func AddTestAddrsIncremental

func AddTestAddrsIncremental(app *app.App, ctx sdk.Context, accNum int, accAmt sdk.Int) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func GenTx

func GenTx(gen client.TxConfig, msgs []sdk.Msg, feeAmt sdk.Coins, gas uint64, chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey) (sdk.Tx, error)

GenTx generates a signed mock transaction.

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString generates a random string given a length, based on a set character set

func GenerateRandomStringWithCharset

func GenerateRandomStringWithCharset(length int, charset string) string

func GenerateRandomTestAccounts

func GenerateRandomTestAccounts(accNum int) []sdk.AccAddress

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) app.GenesisState

NewDefaultGenesisState generates the default state for the application.

func RandInBetween

func RandInBetween(min, max int) int

func SetKeeperTestParamsAndDefaultValues

func SetKeeperTestParamsAndDefaultValues(app *app.App, ctx sdk.Context)

func Setup

func Setup(isCheckTx bool) *app.App

Setup initializes a new app.App. A Nop logger is set in app.App.

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type EmptyAppOptions

type EmptyAppOptions struct{}

EmptyAppOptions is a stub implementing AppOptions

func (EmptyAppOptions) Get

func (ao EmptyAppOptions) Get(o string) interface{}

Get implements AppOptions

type GenerateAccountStrategy

type GenerateAccountStrategy func(int) []sdk.AccAddress

Jump to

Keyboard shortcuts

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