cleanup TestInitGenesis

This commit is contained in:
rigelrozanski 2018-04-03 15:47:26 -04:00
parent cfb3ba75af
commit a85fdcc23b
2 changed files with 20 additions and 41 deletions

View File

@ -577,46 +577,26 @@ func TestPool(t *testing.T) {
func TestInitGenesis(t *testing.T) { func TestInitGenesis(t *testing.T) {
ctx, _, keeper := createTestInput(t, nil, false, 0) ctx, _, keeper := createTestInput(t, nil, false, 0)
encoded := json.RawMessage(`{ jsonStr := `{
"params": { "params": {
"inflation_rate_change": { "inflation_rate_change": {"num": 13, "denom": 100},
"num": 13, "inflation_max": {"num": 20, "denom": 100},
"denom": 100 "inflation_min": {"num": 7, "denom": 100},
}, "goal_bonded": {"num": 67, "denom": 100},
"inflation_max": { "max_validators": 100,
"num": 20, "bond_denom": "fermion"
"denom": 100 },
}, "pool": {
"inflation_min": { "total_supply": 0,
"num": 7, "bonded_shares": {"num": 0, "denom": 1},
"denom": 100 "unbonded_shares": {"num": 0, "denom": 1},
}, "bonded_pool": 0,
"goal_bonded": { "unbonded_pool": 0,
"num": 67, "inflation_last_time": 0,
"denom": 100 "inflation": {"num": 7, "denom": 100}
}, }
"max_validators": 100, }`
"bond_denom": "fermion" encoded := json.RawMessage(jsonStr)
},
"pool": {
"total_supply": 0,
"bonded_shares": {
"num": 0,
"denom": 1
},
"unbonded_shares": {
"num": 0,
"denom": 1
},
"bonded_pool": 0,
"unbonded_pool": 0,
"inflation_last_time": 0,
"inflation": {
"num": 7,
"denom": 100
}
}
}`)
err := keeper.InitGenesis(ctx, encoded) err := keeper.InitGenesis(ctx, encoded)
require.Nil(t, err) require.Nil(t, err)
require.Equal(t, keeper.GetPool(ctx), initialPool()) require.Equal(t, keeper.GetPool(ctx), initialPool())

View File

@ -30,7 +30,6 @@ type Pool struct {
} }
// GenesisState - all staking state that must be provided at genesis // GenesisState - all staking state that must be provided at genesis
type GenesisState struct { type GenesisState struct {
Pool Pool `json:"pool"` Pool Pool `json:"pool"`
Params Params `json:"params"` Params Params `json:"params"`