use simapp into keeper
This commit is contained in:
parent
c0a4222e6b
commit
f912618b8a
|
@ -1,24 +1,28 @@
|
||||||
package keeper
|
package keeper_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/simapp"
|
||||||
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestParams(t *testing.T) {
|
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()
|
expParams := types.DefaultParams()
|
||||||
|
|
||||||
//check that the empty keeper loads the default
|
//check that the empty keeper loads the default
|
||||||
resParams := keeper.GetParams(ctx)
|
resParams := app.StakingKeeper.GetParams(ctx)
|
||||||
require.True(t, expParams.Equal(resParams))
|
require.True(t, expParams.Equal(resParams))
|
||||||
|
|
||||||
//modify a params, save, and retrieve
|
//modify a params, save, and retrieve
|
||||||
expParams.MaxValidators = 777
|
expParams.MaxValidators = 777
|
||||||
keeper.SetParams(ctx, expParams)
|
app.StakingKeeper.SetParams(ctx, expParams)
|
||||||
resParams = keeper.GetParams(ctx)
|
resParams = app.StakingKeeper.GetParams(ctx)
|
||||||
require.True(t, expParams.Equal(resParams))
|
require.True(t, expParams.Equal(resParams))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue