update pagination tests (#8565)
This commit is contained in:
parent
dfc8dd813e
commit
bddbc131fd
|
@ -8,7 +8,6 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
|
@ -32,7 +31,7 @@ func (s *paginationTestSuite) TestFilteredPaginations() {
|
|||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(app.BankKeeper.SetBalances(ctx, addr1, balances))
|
||||
store := ctx.KVStore(app.GetKey(authtypes.StoreKey))
|
||||
store := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
|
||||
// verify pagination with limit > total values
|
||||
pageReq := &query.PageRequest{Key: nil, Limit: 5, CountTotal: true}
|
||||
|
@ -110,7 +109,7 @@ func ExampleFilteredPaginate() {
|
|||
}
|
||||
|
||||
pageReq := &query.PageRequest{Key: nil, Limit: 1, CountTotal: true}
|
||||
store := ctx.KVStore(app.GetKey(authtypes.StoreKey))
|
||||
store := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
balancesStore := prefix.NewStore(store, types.BalancesPrefix)
|
||||
accountStore := prefix.NewStore(balancesStore, address.MustLengthPrefix(addr1))
|
||||
|
||||
|
|
|
@ -19,9 +19,6 @@ import (
|
|||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
|
@ -192,7 +189,7 @@ func ExamplePaginate() {
|
|||
pageReq := &query.PageRequest{Key: nil, Limit: 1, CountTotal: true}
|
||||
request := types.NewQueryAllBalancesRequest(addr1, pageReq)
|
||||
balResult := sdk.NewCoins()
|
||||
authStore := ctx.KVStore(app.GetKey(authtypes.StoreKey))
|
||||
authStore := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
balancesStore := prefix.NewStore(authStore, types.BalancesPrefix)
|
||||
accountStore := prefix.NewStore(balancesStore, address.MustLengthPrefix(addr1))
|
||||
pageRes, err := query.Paginate(accountStore, request.Pagination, func(key []byte, value []byte) error {
|
||||
|
@ -222,20 +219,5 @@ func setupTest() (*simapp.SimApp, sdk.Context, codec.Marshaler) {
|
|||
|
||||
ms.LoadLatestVersion()
|
||||
|
||||
maccPerms := simapp.GetMaccPerms()
|
||||
maccPerms[holder] = nil
|
||||
maccPerms[authtypes.Burner] = []string{authtypes.Burner}
|
||||
maccPerms[authtypes.Minter] = []string{authtypes.Minter}
|
||||
maccPerms[multiPerm] = []string{authtypes.Burner, authtypes.Minter, authtypes.Staking}
|
||||
maccPerms[randomPerm] = []string{"random"}
|
||||
app.AccountKeeper = authkeeper.NewAccountKeeper(
|
||||
appCodec, app.GetKey(authtypes.StoreKey), app.GetSubspace(authtypes.ModuleName),
|
||||
authtypes.ProtoBaseAccount, maccPerms,
|
||||
)
|
||||
app.BankKeeper = bankkeeper.NewBaseKeeper(
|
||||
appCodec, app.GetKey(authtypes.StoreKey), app.AccountKeeper,
|
||||
app.GetSubspace(types.ModuleName), make(map[string]bool),
|
||||
)
|
||||
|
||||
return app, ctx, appCodec
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue