diff --git a/x/auth/keeper/grpc_query_test.go b/x/auth/keeper/grpc_query_test.go index a404020820..07d45e5273 100644 --- a/x/auth/keeper/grpc_query_test.go +++ b/x/auth/keeper/grpc_query_test.go @@ -375,4 +375,4 @@ func (suite *KeeperTestSuite) TestAddressStringToBytes() { }) } -} \ No newline at end of file +} diff --git a/x/mint/keeper/integration_test.go b/x/mint/keeper/integration_test.go deleted file mode 100644 index c293751a25..0000000000 --- a/x/mint/keeper/integration_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -import ( - "testing" - - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - "github.com/cosmos/cosmos-sdk/simapp" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/mint/types" -) - -// returns context and an app with updated mint keeper -func createTestApp(t *testing.T, isCheckTx bool) (*simapp.SimApp, sdk.Context) { - app := simapp.Setup(t, isCheckTx) - - ctx := app.BaseApp.NewContext(isCheckTx, tmproto.Header{}) - app.MintKeeper.SetParams(ctx, types.DefaultParams()) - app.MintKeeper.SetMinter(ctx, types.DefaultInitialMinter()) - - return app, ctx -} diff --git a/x/mint/keeper/querier_test.go b/x/mint/keeper/querier_test.go index 5e8d00ecc0..2093da8751 100644 --- a/x/mint/keeper/querier_test.go +++ b/x/mint/keeper/querier_test.go @@ -3,20 +3,42 @@ package keeper_test import ( "testing" - "github.com/cosmos/cosmos-sdk/codec" - "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + abci "github.com/tendermint/tendermint/abci/types" + tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" keep "github.com/cosmos/cosmos-sdk/x/mint/keeper" "github.com/cosmos/cosmos-sdk/x/mint/types" - - abci "github.com/tendermint/tendermint/abci/types" ) -func TestNewQuerier(t *testing.T) { - app, ctx := createTestApp(t, true) +type MintKeeperTestSuite struct { + suite.Suite + + app *simapp.SimApp + ctx sdk.Context + legacyQuerierCdc *codec.AminoCodec +} + +func (suite *MintKeeperTestSuite) SetupTest() { + app := simapp.Setup(suite.T(), true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + + app.MintKeeper.SetParams(ctx, types.DefaultParams()) + app.MintKeeper.SetMinter(ctx, types.DefaultInitialMinter()) + legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) + + suite.app = app + suite.ctx = ctx + suite.legacyQuerierCdc = legacyQuerierCdc +} + +func (suite *MintKeeperTestSuite) TestNewQuerier(t *testing.T) { + app, ctx, legacyQuerierCdc := suite.app, suite.ctx, suite.legacyQuerierCdc querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino) query := abci.RequestQuery{ @@ -37,9 +59,8 @@ func TestNewQuerier(t *testing.T) { require.Error(t, err) } -func TestQueryParams(t *testing.T) { - app, ctx := createTestApp(t, true) - legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) +func (suite *MintKeeperTestSuite) TestQueryParams(t *testing.T) { + app, ctx, legacyQuerierCdc := suite.app, suite.ctx, suite.legacyQuerierCdc querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino) var params types.Params @@ -53,9 +74,8 @@ func TestQueryParams(t *testing.T) { require.Equal(t, app.MintKeeper.GetParams(ctx), params) } -func TestQueryInflation(t *testing.T) { - app, ctx := createTestApp(t, true) - legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) +func (suite *MintKeeperTestSuite) TestQueryInflation(t *testing.T) { + app, ctx, legacyQuerierCdc := suite.app, suite.ctx, suite.legacyQuerierCdc querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino) var inflation sdk.Dec @@ -69,9 +89,8 @@ func TestQueryInflation(t *testing.T) { require.Equal(t, app.MintKeeper.GetMinter(ctx).Inflation, inflation) } -func TestQueryAnnualProvisions(t *testing.T) { - app, ctx := createTestApp(t, true) - legacyQuerierCdc := codec.NewAminoCodec(app.LegacyAmino()) +func (suite *MintKeeperTestSuite) TestQueryAnnualProvisions(t *testing.T) { + app, ctx, legacyQuerierCdc := suite.app, suite.ctx, suite.legacyQuerierCdc querier := keep.NewQuerier(app.MintKeeper, legacyQuerierCdc.LegacyAmino) var annualProvisions sdk.Dec diff --git a/x/params/keeper/keeper_test.go b/x/params/keeper/keeper_test.go index 92e2afb918..043e715ca2 100644 --- a/x/params/keeper/keeper_test.go +++ b/x/params/keeper/keeper_test.go @@ -26,9 +26,10 @@ type KeeperTestSuite struct { } func (suite *KeeperTestSuite) SetupTest() { - suite.app = simapp.Setup(suite.T(), false) - suite.ctx = suite.app.BaseApp.NewContext(false, tmproto.Header{}) + app := simapp.Setup(suite.T(), true) + ctx := app.BaseApp.NewContext(true, tmproto.Header{}) + suite.app, suite.ctx = app, ctx queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) proposal.RegisterQueryServer(queryHelper, suite.app.ParamsKeeper) suite.queryClient = proposal.NewQueryClient(queryHelper)