Skip to content

Commit

Permalink
register commands, add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed May 21, 2024
1 parent 98e3f32 commit 2d75f2a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions x/attribute/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func NewTxCmd() *cobra.Command {
NewDeleteAccountAttributeCmd(),
NewSetAccountDataCmd(),
NewUpdateAccountAttributeExpirationCmd(),
NewUpdateParamsCmd(),
)
return txCmd
}
Expand Down
45 changes: 45 additions & 0 deletions x/marker/client/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/provenance-io/provenance/testutil/assertions"
testcli "github.com/provenance-io/provenance/testutil/cli"
"github.com/provenance-io/provenance/testutil/queries"
"github.com/provenance-io/provenance/x/attribute/client/cli"
attrcli "github.com/provenance-io/provenance/x/attribute/client/cli"
attrtypes "github.com/provenance-io/provenance/x/attribute/types"
markercli "github.com/provenance-io/provenance/x/marker/client/cli"
Expand Down Expand Up @@ -2507,3 +2508,47 @@ func (s *IntegrationTestSuite) TestSetDenomMetadataProposal() {
})
}
}

func (s *IntegrationTestSuite) TestUpdateParamsProposal() {
testCases := []struct {
name string
args []string
expectErrMsg string
expectedCode uint32
signer string
}{
{
name: "success - submit update params proposal",
args: []string{"100"},
expectedCode: 0,
signer: s.testnet.Validators[0].Address.String(),
},
{
name: "failure - invalid max value length",
args: []string{"invalidlength"},
expectErrMsg: `invalid max value length: strconv.ParseUint: parsing "invalidlength": invalid syntax`,
signer: s.testnet.Validators[0].Address.String(),
},
}

for _, tc := range testCases {
s.Run(tc.name, func() {
cmd := cli.NewUpdateParamsCmd()
tc.args = append(tc.args,
"--title", fmt.Sprintf("title: %v", tc.name),
"--summary", fmt.Sprintf("summary: %v", tc.name),
"--deposit=1000000stake",
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.NewTxExecutor(cmd, tc.args).
WithExpErrMsg(tc.expectErrMsg).
WithExpCode(tc.expectedCode).
Execute(s.T(), s.testnet)
})
}
}

0 comments on commit 2d75f2a

Please sign in to comment.