Skip to content

Commit

Permalink
add msgfees prop test for update conversion fee denom
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed May 13, 2024
1 parent 97f7aff commit dd30914
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
42 changes: 42 additions & 0 deletions x/msgfees/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,46 @@ func (s *IntegrationTestSuite) TestUpdateNhashPerUsdMilProposal() {
}
}

func (s *IntegrationTestSuite) TestUpdateConversionFeeDenomProposal() {
testCases := []struct {
name string
args []string
expectErrMsg string
expectedCode uint32
signer string
}{
{
name: "success - valid denom update",
args: []string{"customcoin"},
expectedCode: 0,
signer: s.accountAddresses[0].String(),
},
{
name: "failure - too many arguments",
args: []string{"customcoin", "unexpected"},
expectErrMsg: "accepts 1 arg(s), received 2",
signer: s.accountAddresses[0].String(),
},
}

for _, tc := range testCases {
s.Run(tc.name, func() {
cmd := cli.GetUpdateConversionFeeDenomProposal()
tc.args = append(tc.args,
"--title", "Update conversion fee denom proposal", "--summary", "Updates the conversion fee denom.",
fmt.Sprintf("--%s=%s", flags.FlagFrom, tc.signer),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewInt64Coin(s.cfg.BondDenom, 10)).String()),
fmt.Sprintf("--%s=json", cmtcli.OutputFlag),
)

testcli.NewCLITxExecutor(cmd, tc.args).
WithExpErrMsg(tc.expectErrMsg).
WithExpCode(tc.expectedCode).
Execute(s.T(), s.testnet)
})
}
}

// TODO: Add query tests
3 changes: 0 additions & 3 deletions x/msgfees/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ $ %[1]s tx msgfees cfd customcoin --deposit 1000000000nhash
}
customCoin := args[0]
msg := types.NewMsgUpdateConversionFeeDenomProposalRequest(customCoin, authority)
if err != nil {
return err
}
return provcli.GenerateOrBroadcastTxCLIAsGovProp(clientCtx, flagSet, msg)
},
}
Expand Down

0 comments on commit dd30914

Please sign in to comment.