Documentation ¶
Overview ¶
Package keeper provides methods to initialize SDK keepers with local storage for test purposes
Index ¶
- Variables
- func ModuleAccountAddrs(maccPerms map[string][]string) map[string]bool
- func NewTestSetup(t testing.TB, options ...SetupOption) (sdk.Context, TestKeepers, TestMsgServers)
- type Initializer
- func (i *Initializer) Auth(maccPerms map[string][]string) authkeeper.AccountKeeper
- func (i *Initializer) Bank(authKeeper authkeeper.AccountKeeper, maccPerms map[string][]string) bankkeeper.Keeper
- func (i *Initializer) Distribution(authKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, ...) distrkeeper.Keeper
- func (i *Initializer) FeeGrant(authKeeper authkeeper.AccountKeeper) feegrantkeeper.Keeper
- func (i *Initializer) LoadLatest() error
- func (i *Initializer) Staking(authKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper) *stakingkeeper.Keeper
- func (i *Initializer) Upgrade() *upgradekeeper.Keeper
- type ProtocolVersionSetter
- type SetupOption
- type SetupOptions
- type TestKeepers
- type TestMsgServers
Constants ¶
This section is empty.
Variables ¶
var ( // ExampleTimestamp is a timestamp used as the current time for the context of the keepers returned from the package ExampleTimestamp = time.Date(2020, time.January, 1, 12, 0, 0, 0, time.UTC) // ExampleHeight is a block height used as the current block height for the context of test keeper ExampleHeight = int64(1111) )
Functions ¶
func ModuleAccountAddrs ¶
ModuleAccountAddrs returns all the app's module account addresses.
func NewTestSetup ¶
func NewTestSetup(t testing.TB, options ...SetupOption) (sdk.Context, TestKeepers, TestMsgServers)
NewTestSetup returns initialized instances of all the keepers and message servers of the modules
Types ¶
type Initializer ¶
type Initializer struct { Codec codec.Codec Amino *codec.LegacyAmino DB *dbm.MemDB StateStore store.CommitMultiStore Logger log.Logger }
Initializer allows initializing of each module keeper.
func (*Initializer) Auth ¶
func (i *Initializer) Auth(maccPerms map[string][]string) authkeeper.AccountKeeper
func (*Initializer) Bank ¶
func (i *Initializer) Bank(authKeeper authkeeper.AccountKeeper, maccPerms map[string][]string) bankkeeper.Keeper
func (*Initializer) Distribution ¶
func (i *Initializer) Distribution( authKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, stakingKeeper *stakingkeeper.Keeper, ) distrkeeper.Keeper
func (*Initializer) FeeGrant ¶
func (i *Initializer) FeeGrant( authKeeper authkeeper.AccountKeeper, ) feegrantkeeper.Keeper
func (*Initializer) LoadLatest ¶
func (i *Initializer) LoadLatest() error
func (*Initializer) Staking ¶
func (i *Initializer) Staking( authKeeper authkeeper.AccountKeeper, bankKeeper bankkeeper.Keeper, ) *stakingkeeper.Keeper
func (*Initializer) Upgrade ¶
func (i *Initializer) Upgrade() *upgradekeeper.Keeper
type ProtocolVersionSetter ¶
type ProtocolVersionSetter struct{}
func (ProtocolVersionSetter) SetProtocolVersion ¶
func (vs ProtocolVersionSetter) SetProtocolVersion(uint64)
type SetupOption ¶
type SetupOption func(*SetupOptions)
SetupOption represents an option that can be provided to NewTestSetup
func WithAdditionalModuleAccounts ¶
func WithAdditionalModuleAccounts(maccPerms map[string][]string) SetupOption
WithAdditionalModuleAccounts adds additional module accounts to the testing config.
type SetupOptions ¶
type SetupOptions struct { // AdditionalModuleAccountPerms represents any added module account permissions that need to // be passed to the keeper initializer AdditionalModuleAccountPerms map[string][]string }
SetupOptions represents the options to configure the setup of a keeper-level integration test.
type TestKeepers ¶
type TestKeepers struct { T testing.TB Initializer *Initializer AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper DistrKeeper distrkeeper.Keeper StakingKeeper *stakingkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper }
TestKeepers holds all keepers used during keeper tests for all modules
func (*TestKeepers) MintToAccount ¶
MintToAccount mints the specified coins into the account balance.
func (*TestKeepers) MintToModule ¶
MintToModule mints the specified coins into the module account balance.
type TestMsgServers ¶
TestMsgServers holds all message servers used during keeper tests for all modules