Skip to content

Commit

Permalink
fix: tests from mint default settings changes
Browse files Browse the repository at this point in the history
  • Loading branch information
daeMOn63 committed Apr 22, 2021
1 parent 7067b60 commit e5332ee
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 42 deletions.
4 changes: 2 additions & 2 deletions x/bank/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryTotalSupply() {
expected: &types.QueryTotalSupplyResponse{
Supply: sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))),
)},
},
{
Expand All @@ -193,7 +193,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryTotalSupply() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
respType: &sdk.Coin{},
expected: &sdk.Coin{s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))},
expected: &sdk.Coin{s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))},
},
{
name: "total supply of a bogus denom",
Expand Down
8 changes: 4 additions & 4 deletions x/bank/client/rest/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (s *IntegrationTestSuite) TestTotalSupplyGRPCHandler() {
&types.QueryTotalSupplyResponse{
Supply: sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))),
),
},
},
Expand All @@ -48,7 +48,7 @@ func (s *IntegrationTestSuite) TestTotalSupplyGRPCHandler() {
},
&types.QuerySupplyOfResponse{},
&types.QuerySupplyOfResponse{
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))),
},
},
{
Expand All @@ -59,7 +59,7 @@ func (s *IntegrationTestSuite) TestTotalSupplyGRPCHandler() {
},
&types.QuerySupplyOfResponse{},
&types.QuerySupplyOfResponse{
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(20))),
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(4))),
},
},
{
Expand All @@ -70,7 +70,7 @@ func (s *IntegrationTestSuite) TestTotalSupplyGRPCHandler() {
},
&types.QuerySupplyOfResponse{},
&types.QuerySupplyOfResponse{
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
Amount: sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))),
},
},
{
Expand Down
4 changes: 2 additions & 2 deletions x/bank/client/rest/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ func (s *IntegrationTestSuite) TestTotalSupplyHandlerFn() {
&sdk.Coins{},
sdk.NewCoins(
sdk.NewCoin(fmt.Sprintf("%stoken", val.Moniker), s.cfg.AccountTokens),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))),
),
},
{
"total supply of a specific denom",
fmt.Sprintf("%s/bank/total/%s?height=1", baseURL, s.cfg.BondDenom),
&sdk.Coin{},
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(10))),
sdk.NewCoin(s.cfg.BondDenom, s.cfg.StakingTokens.Add(sdk.NewInt(2))),
},
{
"total supply of a bogus denom",
Expand Down
24 changes: 11 additions & 13 deletions x/distribution/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ func (s *IntegrationTestSuite) SetupTest() {

inflation := sdk.MustNewDecFromStr("1.0")
mintData.Minter.Inflation = inflation
mintData.Params.InflationMin = inflation
mintData.Params.InflationMax = inflation

mintDataBz, err := cfg.Codec.MarshalJSON(&mintData)
s.Require().NoError(err)
Expand Down Expand Up @@ -134,7 +132,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorOutstandingRewards() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
`{"rewards":[{"denom":"stake","amount":"232.260000000000000000"}]}`,
`{"rewards":[{"denom":"stake","amount":"5.880000000000000000"}]}`,
},
{
"text output",
Expand All @@ -145,7 +143,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorOutstandingRewards() {
},
false,
`rewards:
- amount: "232.260000000000000000"
- amount: "5.880000000000000000"
denom: stake`,
},
}
Expand Down Expand Up @@ -197,7 +195,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorCommission() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
`{"commission":[{"denom":"stake","amount":"116.130000000000000000"}]}`,
`{"commission":[{"denom":"stake","amount":"2.940000000000000000"}]}`,
},
{
"text output",
Expand All @@ -208,7 +206,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryValidatorCommission() {
},
false,
`commission:
- amount: "116.130000000000000000"
- amount: "2.940000000000000000"
denom: stake`,
},
}
Expand Down Expand Up @@ -350,7 +348,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegatorRewards() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
fmt.Sprintf(`{"rewards":[{"validator_address":"%s","reward":[{"denom":"stake","amount":"387.100000000000000000"}]}],"total":[{"denom":"stake","amount":"387.100000000000000000"}]}`, valAddr.String()),
fmt.Sprintf(`{"rewards":[{"validator_address":"%s","reward":[{"denom":"stake","amount":"9.800000000000000000"}]}],"total":[{"denom":"stake","amount":"9.800000000000000000"}]}`, valAddr.String()),
},
{
"json output (specific validator)",
Expand All @@ -360,7 +358,7 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegatorRewards() {
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
},
false,
`{"rewards":[{"denom":"stake","amount":"387.100000000000000000"}]}`,
`{"rewards":[{"denom":"stake","amount":"9.800000000000000000"}]}`,
},
{
"text output",
Expand All @@ -372,11 +370,11 @@ func (s *IntegrationTestSuite) TestGetCmdQueryDelegatorRewards() {
false,
fmt.Sprintf(`rewards:
- reward:
- amount: "387.100000000000000000"
- amount: "9.800000000000000000"
denom: stake
validator_address: %s
total:
- amount: "387.100000000000000000"
- amount: "9.800000000000000000"
denom: stake`, valAddr.String()),
},
{
Expand All @@ -388,7 +386,7 @@ total:
},
false,
`rewards:
- amount: "387.100000000000000000"
- amount: "9.800000000000000000"
denom: stake`,
},
}
Expand Down Expand Up @@ -425,13 +423,13 @@ func (s *IntegrationTestSuite) TestGetCmdQueryCommunityPool() {
{
"json output",
[]string{fmt.Sprintf("--%s=3", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`{"pool":[{"denom":"stake","amount":"4.740000000000000000"}]}`,
`{"pool":[{"denom":"stake","amount":"0.120000000000000000"}]}`,
},
{
"text output",
[]string{fmt.Sprintf("--%s=text", tmcli.OutputFlag), fmt.Sprintf("--%s=3", flags.FlagHeight)},
`pool:
- amount: "4.740000000000000000"
- amount: "0.120000000000000000"
denom: stake`,
},
}
Expand Down
8 changes: 4 additions & 4 deletions x/distribution/client/rest/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *IntegrationTestSuite) TestQueryOutstandingRewardsGRPC() {
val := s.network.Validators[0]
baseURL := val.APIAddress

rewards, err := sdk.ParseDecCoins("19.6stake")
rewards, err := sdk.ParseDecCoins("3.92stake")
s.Require().NoError(err)

testCases := []struct {
Expand Down Expand Up @@ -125,7 +125,7 @@ func (s *IntegrationTestSuite) TestQueryValidatorCommissionGRPC() {
val := s.network.Validators[0]
baseURL := val.APIAddress

commission, err := sdk.ParseDecCoins("9.8stake")
commission, err := sdk.ParseDecCoins("1.96stake")
s.Require().NoError(err)

testCases := []struct {
Expand Down Expand Up @@ -238,7 +238,7 @@ func (s *IntegrationTestSuite) TestQueryDelegatorRewardsGRPC() {
val := s.network.Validators[0]
baseUrl := val.APIAddress

rewards, err := sdk.ParseDecCoins("9.8stake")
rewards, err := sdk.ParseDecCoins("1.96stake")
s.Require().NoError(err)

testCases := []struct {
Expand Down Expand Up @@ -418,7 +418,7 @@ func (s *IntegrationTestSuite) TestQueryValidatorCommunityPoolGRPC() {
val := s.network.Validators[0]
baseURL := val.APIAddress

communityPool, err := sdk.ParseDecCoins("0.4stake")
communityPool, err := sdk.ParseDecCoins("0.08stake")
s.Require().NoError(err)

testCases := []struct {
Expand Down
17 changes: 6 additions & 11 deletions x/mint/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ func (s *IntegrationTestSuite) SetupSuite() {

inflation := sdk.MustNewDecFromStr("1.0")
mintData.Minter.Inflation = inflation
mintData.Params.InflationMin = inflation
mintData.Params.InflationMax = inflation

mintDataBz, err := cfg.Codec.MarshalJSON(&mintData)
s.Require().NoError(err)
Expand Down Expand Up @@ -68,16 +66,13 @@ func (s *IntegrationTestSuite) TestGetCmdQueryParams() {
{
"json output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`{"mint_denom":"stake","inflation_rate_change":"0.130000000000000000","inflation_max":"1.000000000000000000","inflation_min":"1.000000000000000000","goal_bonded":"0.670000000000000000","blocks_per_year":"6311520"}`,
`{"mint_denom":"stake","inflation_rate":"0.030000000000000000","blocks_per_year":"6311520"}`,
},
{
"text output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", tmcli.OutputFlag)},
`blocks_per_year: "6311520"
goal_bonded: "0.670000000000000000"
inflation_max: "1.000000000000000000"
inflation_min: "1.000000000000000000"
inflation_rate_change: "0.130000000000000000"
inflation_rate: "0.030000000000000000"
mint_denom: stake`,
},
}
Expand Down Expand Up @@ -107,12 +102,12 @@ func (s *IntegrationTestSuite) TestGetCmdQueryInflation() {
{
"json output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`1.000000000000000000`,
`0.030000000000000000`,
},
{
"text output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", tmcli.OutputFlag)},
`1.000000000000000000`,
`0.030000000000000000`,
},
}

Expand Down Expand Up @@ -141,12 +136,12 @@ func (s *IntegrationTestSuite) TestGetCmdQueryAnnualProvisions() {
{
"json output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=json", tmcli.OutputFlag)},
`500000000.000000000000000000`,
`15000000.000000000000000000`,
},
{
"text output",
[]string{fmt.Sprintf("--%s=1", flags.FlagHeight), fmt.Sprintf("--%s=text", tmcli.OutputFlag)},
`500000000.000000000000000000`,
`15000000.000000000000000000`,
},
}

Expand Down
9 changes: 3 additions & 6 deletions x/mint/client/rest/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ func (s *IntegrationTestSuite) SetupSuite() {

inflation := sdk.MustNewDecFromStr("1.0")
mintData.Minter.Inflation = inflation
mintData.Params.InflationMin = inflation
mintData.Params.InflationMax = inflation

mintDataBz, err := cfg.Codec.MarshalJSON(&mintData)
s.Require().NoError(err)
Expand Down Expand Up @@ -72,8 +70,7 @@ func (s *IntegrationTestSuite) TestQueryGRPC() {
map[string]string{},
&minttypes.QueryParamsResponse{},
&minttypes.QueryParamsResponse{
Params: minttypes.NewParams("stake", sdk.NewDecWithPrec(13, 2), sdk.NewDecWithPrec(100, 2),
sdk.NewDec(1), sdk.NewDecWithPrec(67, 2), (60 * 60 * 8766 / 5)),
Params: minttypes.NewParams("stake", sdk.NewDecWithPrec(3, 2), (60 * 60 * 8766 / 5)),
},
},
{
Expand All @@ -82,7 +79,7 @@ func (s *IntegrationTestSuite) TestQueryGRPC() {
map[string]string{},
&minttypes.QueryInflationResponse{},
&minttypes.QueryInflationResponse{
Inflation: sdk.NewDec(1),
Inflation: sdk.NewDec(0.03),
},
},
{
Expand All @@ -93,7 +90,7 @@ func (s *IntegrationTestSuite) TestQueryGRPC() {
},
&minttypes.QueryAnnualProvisionsResponse{},
&minttypes.QueryAnnualProvisionsResponse{
AnnualProvisions: sdk.NewDec(500000000),
AnnualProvisions: sdk.NewDec(15000000),
},
},
}
Expand Down

0 comments on commit e5332ee

Please sign in to comment.