apptesting

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTestAddrs

func GenerateTestAddrs() (string, string)

These are for testing msg.ValidateBasic() functions which need to validate for valid/invalid addresses. Should not be used for anything else because these addresses are totally uninterpretable (100% random).

func SetupAddr

func SetupAddr(index int) sdk.AccAddress

setupAddr takes a balance, prefix, and address number. Then returns the respective account address byte array. If prefix is left blank, it will be replaced with a random prefix.

func SetupAddrs

func SetupAddrs(numAddrs int) []sdk.AccAddress

Types

type KeeperTestHelper

type KeeperTestHelper struct {
	suite.Suite

	App   *app.App
	Ctx   sdk.Context
	GoCtx context.Context
	// Used for testing queries end to end.
	// You can wrap this in a module-specific QueryClient()
	// and then make calls as you would a normal GRPC client.
	QueryHelper *baseapp.QueryServiceTestHelper
}

func (*KeeperTestHelper) AssertEventEmitted

func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected string, numEventsExpected int)

AssertEventEmitted asserts that ctx's event manager has emitted the given number of events of the given type.

func (*KeeperTestHelper) AssertEventValueEmitted

func (s *KeeperTestHelper) AssertEventValueEmitted(eventValue, message string)

func (*KeeperTestHelper) AssertEventValueNotEmitted

func (s *KeeperTestHelper) AssertEventValueNotEmitted(eventValue, message string)

func (*KeeperTestHelper) AssertNEventValuesEmitted

func (s *KeeperTestHelper) AssertNEventValuesEmitted(eventValue string, nEvents int)

func (*KeeperTestHelper) Commit

func (s *KeeperTestHelper) Commit()

CreateTestContext creates a test context.

func (*KeeperTestHelper) CreateTestContext

func (s *KeeperTestHelper) CreateTestContext() sdk.Context

CreateTestContext creates a test context.

func (*KeeperTestHelper) CreateTestContextWithMultiStore

func (s *KeeperTestHelper) CreateTestContextWithMultiStore() (sdk.Context, sdk.CommitMultiStore)

CreateTestContextWithMultiStore creates a test context and returns it together with multi store.

func (*KeeperTestHelper) ExtractAttributes

func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string

func (*KeeperTestHelper) FindEvent

func (s *KeeperTestHelper) FindEvent(events []sdk.Event, name string) sdk.Event

func (*KeeperTestHelper) FundAcc

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

FundAcc funds target address with specified amount.

func (*KeeperTestHelper) Setup

func (s *KeeperTestHelper) Setup()

Setup sets up basic environment for suite (App, Ctx, and test accounts)

func (*KeeperTestHelper) SetupAddr

func (s *KeeperTestHelper) SetupAddr(index int) sdk.AccAddress

func (*KeeperTestHelper) SetupAddrs

func (s *KeeperTestHelper) SetupAddrs(numAddrs int) []sdk.AccAddress

Jump to

Keyboard shortcuts

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