refactor: Move simapp FundAccount and FundModuleAccount to testutil (#9427)
ref: #9346
This commit is contained in:
@@ -4,11 +4,11 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@ func (s *paginationTestSuite) TestFilteredPaginations() {
|
||||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
s.Require().NoError(testutil.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
store := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
|
||||
// verify pagination with limit > total values
|
||||
@@ -107,7 +107,7 @@ func (s *paginationTestSuite) TestReverseFilteredPaginations() {
|
||||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
s.Require().NoError(testutil.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
store := ctx.KVStore(app.GetKey(types.StoreKey))
|
||||
|
||||
// verify pagination with limit > total values
|
||||
@@ -188,7 +188,7 @@ func ExampleFilteredPaginate() {
|
||||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
err := simapp.FundAccount(app.BankKeeper, ctx, addr1, balances)
|
||||
err := testutil.FundAccount(app.BankKeeper, ctx, addr1, balances)
|
||||
if err != nil { // should return no error
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/address"
|
||||
"github.com/cosmos/cosmos-sdk/types/query"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/testutil"
|
||||
"github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
)
|
||||
|
||||
@@ -76,7 +77,7 @@ func (s *paginationTestSuite) TestPagination() {
|
||||
addr1 := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
s.Require().NoError(testutil.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
s.T().Log("verify empty page request results a max of defaultLimit records and counts total records")
|
||||
pageReq := &query.PageRequest{}
|
||||
@@ -185,7 +186,7 @@ func (s *paginationTestSuite) TestReversePagination() {
|
||||
addr1 := sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
s.Require().NoError(simapp.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
s.Require().NoError(testutil.FundAccount(app.BankKeeper, ctx, addr1, balances))
|
||||
|
||||
s.T().Log("verify paginate with custom limit and countTotal, Reverse false")
|
||||
pageReq := &query.PageRequest{Limit: 2, CountTotal: true, Reverse: true, Key: nil}
|
||||
@@ -306,7 +307,7 @@ func ExamplePaginate() {
|
||||
addr1 := sdk.AccAddress([]byte("addr1"))
|
||||
acc1 := app.AccountKeeper.NewAccountWithAddress(ctx, addr1)
|
||||
app.AccountKeeper.SetAccount(ctx, acc1)
|
||||
err := simapp.FundAccount(app.BankKeeper, ctx, addr1, balances)
|
||||
err := testutil.FundAccount(app.BankKeeper, ctx, addr1, balances)
|
||||
if err != nil { // should return no error
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user