use simapp into keeper

This commit is contained in:
Jonathan Gimeno 2020-02-18 13:42:53 +01:00
parent c0a4222e6b
commit f912618b8a
1 changed files with 9 additions and 5 deletions

View File

@ -1,24 +1,28 @@
package keeper
package keeper_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/staking/types"
abci "github.com/tendermint/tendermint/abci/types"
)
func TestParams(t *testing.T) {
ctx, _, _, keeper, _ := CreateTestInput(t, false, 0)
app := simapp.Setup(false)
ctx := app.BaseApp.NewContext(false, abci.Header{})
expParams := types.DefaultParams()
//check that the empty keeper loads the default
resParams := keeper.GetParams(ctx)
resParams := app.StakingKeeper.GetParams(ctx)
require.True(t, expParams.Equal(resParams))
//modify a params, save, and retrieve
expParams.MaxValidators = 777
keeper.SetParams(ctx, expParams)
resParams = keeper.GetParams(ctx)
app.StakingKeeper.SetParams(ctx, expParams)
resParams = app.StakingKeeper.GetParams(ctx)
require.True(t, expParams.Equal(resParams))
}