From e673249b5b778681fbffad5e64c1e01577573fb1 Mon Sep 17 00:00:00 2001 From: marbar3778 Date: Mon, 13 May 2024 12:16:04 +0200 Subject: [PATCH] fix tests --- x/bank/keeper/grpc_query_test.go | 9 --------- x/bank/keeper/keeper_test.go | 21 +++++---------------- 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/x/bank/keeper/grpc_query_test.go b/x/bank/keeper/grpc_query_test.go index c2bc94f1efe1..a5b4e352c88c 100644 --- a/x/bank/keeper/grpc_query_test.go +++ b/x/bank/keeper/grpc_query_test.go @@ -10,7 +10,6 @@ import ( vestingtypes "cosmossdk.io/x/auth/vesting/types" "cosmossdk.io/x/bank/testutil" "cosmossdk.io/x/bank/types" - banktypes "cosmossdk.io/x/bank/types" codectestutil "github.com/cosmos/cosmos-sdk/codec/testutil" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -607,10 +606,6 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwners() { suite.mockMintCoins(mintAcc) suite.Require().NoError(keeper.MintCoins(ctx, types.MintModuleName, initCoins)) - suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ - DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, - })) - for i := 0; i < 10; i++ { addr := sdk.AccAddress(fmt.Sprintf("account-%d", i)) @@ -836,10 +831,6 @@ func (suite *KeeperTestSuite) TestGRPCDenomOwnersByQuery() { suite.mockMintCoins(mintAcc) suite.Require().NoError(keeper.MintCoins(ctx, types.MintModuleName, newCoins)) - suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ - DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, - })) - for i := 0; i < 10; i++ { addr := sdk.AccAddress(fmt.Sprintf("account-%d", i)) diff --git a/x/bank/keeper/keeper_test.go b/x/bank/keeper/keeper_test.go index c9d07ccd431e..45fdb7031dc8 100644 --- a/x/bank/keeper/keeper_test.go +++ b/x/bank/keeper/keeper_test.go @@ -154,6 +154,10 @@ func (suite *KeeperTestSuite) SetupTest() { authority, ) + suite.Require().NoError(suite.bankKeeper.SetParams(ctx, banktypes.Params{ + DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, + })) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) @@ -177,7 +181,7 @@ func (suite *KeeperTestSuite) mockMintCoins(moduleAcc *authtypes.ModuleAccount) func (suite *KeeperTestSuite) mockSendCoinsFromModuleToAccount(moduleAcc *authtypes.ModuleAccount, _ sdk.AccAddress) { suite.authKeeper.EXPECT().GetModuleAddress(moduleAcc.Name).Return(moduleAcc.GetAddress()) - suite.authKeeper.EXPECT().GetAccount(suite.ctx, moduleAcc.GetAddress()).Return(moduleAcc).AnyTimes() + suite.authKeeper.EXPECT().GetAccount(suite.ctx, moduleAcc.GetAddress()).Return(moduleAcc) } func (suite *KeeperTestSuite) mockBurnCoins(moduleAcc *authtypes.ModuleAccount) { @@ -408,13 +412,6 @@ func (suite *KeeperTestSuite) TestSupply_DelegateUndelegateCoins() { require := suite.Require() authKeeper, keeper := suite.authKeeper, suite.bankKeeper - require.NoError(keeper.SetParams(ctx, banktypes.Params{ - DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, - })) - - res := keeper.GetParams(ctx) - fmt.Println(res) - // set initial balances suite.mockMintCoins(mintAcc) require.NoError(keeper.MintCoins(ctx, banktypes.MintModuleName, initCoins)) @@ -1702,10 +1699,6 @@ func (suite *KeeperTestSuite) TestDelegateCoins() { vacc, err := vesting.NewContinuousVestingAccount(acc0, origCoins, ctx.HeaderInfo().Time.Unix(), endTime.Unix()) suite.Require().NoError(err) - suite.Require().NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ - DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, - })) - suite.mockFundAccount(accAddrs[0]) require.NoError(banktestutil.FundAccount(ctx, suite.bankKeeper, accAddrs[0], origCoins)) @@ -1884,10 +1877,6 @@ func (suite *KeeperTestSuite) TestIterateAllDenomMetaData() { func (suite *KeeperTestSuite) TestBalanceTrackingEvents() { require := suite.Require() - require.NoError(suite.bankKeeper.SetParams(suite.ctx, banktypes.Params{ - DefaultSendEnabled: banktypes.DefaultDefaultSendEnabled, - })) - // mint coins suite.mockMintCoins(multiPermAcc) require.NoError(