suite

package
v0.0.1-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 authtypes.AccountI
	Priv    cryptotypes.PrivKey
}

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

type TestCase

type TestCase struct {
	Name     string
	Malleate func(*TestSuite) TestCaseArgs
	RunAnte  bool
	RunPost  bool
	Simulate bool
	ExpPass  bool
	ExpErr   error
}

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 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 feemarketpost.FeeMarketKeeper
	BankKeeper      feemarketante.BankKeeper
	FeeGrantKeeper  feemarketante.FeeGrantKeeper

	MockBankKeeper     *mocks.BankKeeper
	MockFeeGrantKeeper *mocks.FeeGrantKeeper
	EncCfg             encoding.TestEncodingConfig
}

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) 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