suite

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InterfaceRegistry

func InterfaceRegistry() codectypes.InterfaceRegistry

func NewTestFeeAmount

func NewTestFeeAmount() sdk.Coins

NewTestFeeAmount is a test fee amount.

func NewTestGasLimit

func NewTestGasLimit() uint64

NewTestGasLimit is a test fee gas limit.

Types

type TestAccount

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

TestAccount represents an account used in the tests in x/auth/ante.

type TestAccountBalance

type TestAccountBalance struct {
	TestAccount
	sdk.Coins
}

type TestCase

type TestCase struct {
	Name              string
	Malleate          func(*TestSuite) TestCaseArgs
	StateUpdate       func(*TestSuite)
	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
}

type TestEncodingConfig

type TestEncodingConfig struct {
	InterfaceRegistry codectypes.InterfaceRegistry
	Codec             codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

TestEncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.

func MakeTestEncodingConfig

func MakeTestEncodingConfig() TestEncodingConfig

MakeTestEncodingConfig creates a test EncodingConfig for a test configuration.

type TestSuite

type TestSuite struct {
	suite.Suite

	Ctx         sdk.Context
	AnteHandler sdk.AnteHandler
	PostHandler sdk.PostHandler
	ClientCtx   client.Context
	TxBuilder   client.TxBuilder

	AccountKeeper   feemarketante.AccountKeeper
	FeeMarketKeeper *feemarketkeeper.Keeper
	BankKeeper      bankkeeper.Keeper
	FeeGrantKeeper  feemarketante.FeeGrantKeeper

	MockBankKeeper     *xfeemarketpostmocks.BankKeeper
	MockFeeGrantKeeper *mocks.FeeGrantKeeper
	EncCfg             TestEncodingConfig

	MsgServer feemarkettypes.MsgServer
}

func SetupTestSuite

func SetupTestSuite(t *testing.T, mock bool) *TestSuite

SetupTestSuite setups a new test, with new app, context, and anteHandler.

func (*TestSuite) CreateTestAccounts

func (s *TestSuite) CreateTestAccounts(numAccs int) []TestAccount

func (*TestSuite) CreateTestTx

func (s *TestSuite) CreateTestTx(privs []cryptotypes.PrivKey, accNums []uint64, accSeqs []uint64, chainID string) (authsigning.Tx, error)

CreateTestTx is a helper function to create a tx given multiple inputs.

func (*TestSuite) DeliverMsgs

func (s *TestSuite) DeliverMsgs(t *testing.T, privs []cryptotypes.PrivKey, msgs []sdk.Msg, feeAmount sdk.Coins, gasLimit uint64, accNums, accSeqs []uint64, chainID string, simulate bool) (sdk.Context, error)

DeliverMsgs constructs a tx and runs it through the ante handler. This is used to set the context for a test case, for example to test for replay protection.

func (*TestSuite) RunTestCase

func (s *TestSuite) RunTestCase(t *testing.T, tc TestCase, args TestCaseArgs)

func (*TestSuite) SetAccountBalances

func (s *TestSuite) SetAccountBalances(accounts []TestAccountBalance)

func (*TestSuite) SetupHandlers

func (s *TestSuite) SetupHandlers(mock bool)

Jump to

Keyboard shortcuts

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