testutil

package
v30.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeeperTestHelper

type KeeperTestHelper struct {
	suite.Suite

	App          *app.App
	Ctx          sdk.Context
	QueryHelper  *baseapp.QueryServiceTestHelper
	TestAccs     []sdk.AccAddress
	TestPrivKeys []cryptotypes.PrivKey
	// contains filtered or unexported fields
}

func (*KeeperTestHelper) BeginNewBlock

func (s *KeeperTestHelper) BeginNewBlock()

BeginNewBlock starts a new block.

func (*KeeperTestHelper) BeginNewBlockWithProposer

func (s *KeeperTestHelper) BeginNewBlockWithProposer(proposer sdk.ValAddress)

BeginNewBlockWithProposer begins a new block with a proposer.

func (*KeeperTestHelper) Commit

func (s *KeeperTestHelper) Commit()

func (*KeeperTestHelper) EndBlock

func (s *KeeperTestHelper) EndBlock()

EndBlock ends the block, and runs commit

func (*KeeperTestHelper) FundAcc

func (s *KeeperTestHelper) FundAcc(acc sdk.AccAddress, amounts sdk.Coins)

FundAcc funds target address with specified amount.

func (*KeeperTestHelper) FundModuleAcc

func (s *KeeperTestHelper) FundModuleAcc(moduleName string, amounts sdk.Coins)

FundModuleAcc funds target modules with specified amount.

func (*KeeperTestHelper) InstantiateContract

func (s *KeeperTestHelper) InstantiateContract(sender string, admin string, wasmContract []byte) string

func (*KeeperTestHelper) MintCoins

func (s *KeeperTestHelper) MintCoins(coins sdk.Coins)

func (*KeeperTestHelper) Reset

func (s *KeeperTestHelper) Reset()

Reset resets the test environment requires that all commits go through helpers in s. On first reset, will instantiate a new app, with caching enabled. NOTE: If you are using ABCI methods, usage of Reset vs Setup has not been well tested. It is believed to work, but if you get an odd error, try changing the call to this for setup to sanity check. what's supposed to happen is a new setup call, and reset just does that in such a case.

func (*KeeperTestHelper) Setup

func (s *KeeperTestHelper) Setup()

Setup sets up basic environment for suite (App, Ctx, and test accounts) preserves the caching enabled/disabled state.

func (*KeeperTestHelper) SetupMultipleValidators

func (s *KeeperTestHelper) SetupMultipleValidators(numValidator int) []string

SetupMultipleValidators setups "numValidator" validators and returns their address in string

func (*KeeperTestHelper) SetupTestForInitGenesis

func (s *KeeperTestHelper) SetupTestForInitGenesis()

func (*KeeperTestHelper) SetupValidator

func (s *KeeperTestHelper) SetupValidator(bondStatus stakingtypes.BondStatus) sdk.ValAddress

SetupValidator sets up a validator and returns the ValAddress.

func (*KeeperTestHelper) SetupWithLevelDB

func (s *KeeperTestHelper) SetupWithLevelDB() func()

func (*KeeperTestHelper) StoreCode

func (s *KeeperTestHelper) StoreCode(wasmContract []byte)

type TestAccount

type TestAccount struct {
	Account sdk.AccountI
	Priv    cryptotypes.PrivKey
}

TestAccount represents an address and its private key used in the tests.

type TestCase

type TestCase struct {
	Name              string
	Malleate          func(*KeeperTestHelper) TestCaseArgs
	StateUpdate       func(*KeeperTestHelper)
	RunAnte           bool
	RunPost           bool
	Simulate          bool
	ExpPass           bool
	ExpErr            error
	ExpectConsumedGas uint64
	Mock              bool
}

TestCase represents a test case used in test tables.

type TestCaseArgs

type TestCaseArgs struct {
	ChainID   string
	AccNums   []uint64
	AccSeqs   []uint64
	FeeAmount sdk.Coins
	GasLimit  uint64
	Msgs      []sdk.Msg
	Privs     []cryptotypes.PrivKey
}

Directories

Path Synopsis
nullify
Package nullify provides methods to init nil values structs for test assertion.
Package nullify provides methods to init nil values structs for test assertion.

Jump to

Keyboard shortcuts

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