2020-02-18 04:42:53 -08:00
|
|
|
package keeper_test
|
2018-06-26 19:00:12 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-06-29 18:10:15 -07:00
|
|
|
"github.com/stretchr/testify/require"
|
2018-06-26 19:00:12 -07:00
|
|
|
|
2020-03-20 10:14:14 -07:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
|
2020-02-18 04:42:53 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/simapp"
|
2019-01-11 12:08:01 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/staking/types"
|
2018-06-26 19:00:12 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestParams(t *testing.T) {
|
2020-02-18 04:42:53 -08:00
|
|
|
app := simapp.Setup(false)
|
|
|
|
ctx := app.BaseApp.NewContext(false, abci.Header{})
|
|
|
|
|
2018-06-26 19:00:12 -07:00
|
|
|
expParams := types.DefaultParams()
|
|
|
|
|
|
|
|
//check that the empty keeper loads the default
|
2020-02-18 04:42:53 -08:00
|
|
|
resParams := app.StakingKeeper.GetParams(ctx)
|
2018-06-29 18:10:15 -07:00
|
|
|
require.True(t, expParams.Equal(resParams))
|
2018-06-26 19:00:12 -07:00
|
|
|
|
|
|
|
//modify a params, save, and retrieve
|
|
|
|
expParams.MaxValidators = 777
|
2020-02-18 04:42:53 -08:00
|
|
|
app.StakingKeeper.SetParams(ctx, expParams)
|
|
|
|
resParams = app.StakingKeeper.GetParams(ctx)
|
2018-06-29 18:10:15 -07:00
|
|
|
require.True(t, expParams.Equal(resParams))
|
2018-06-26 19:00:12 -07:00
|
|
|
}
|