add cli help text test

This commit is contained in:
rhuairahrighairigh 2020-04-24 23:36:08 +01:00
parent 733711c88c
commit 114097edb3
2 changed files with 44 additions and 8 deletions

View File

@ -0,0 +1,36 @@
package cli_test
import (
"testing"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/stretchr/testify/suite"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/x/committee/client/cli"
)
type CLITestSuite struct {
suite.Suite
cdc *codec.Codec
}
func (suite *CLITestSuite) SetupTest() {
ahpp := app.NewTestApp()
suite.cdc = ahpp.Codec()
}
func (suite *CLITestSuite) TestExampleCommitteeChangeProposal() {
suite.NotPanics(func() { cli.MustGetExampleCommitteeChangeProposal(suite.cdc) })
}
func (suite *CLITestSuite) TestExampleCommitteeDeleteProposal() {
suite.NotPanics(func() { cli.MustGetExampleCommitteeDeleteProposal(suite.cdc) })
}
func (suite *CLITestSuite) TestExampleParameterChangeProposal() {
suite.NotPanics(func() { cli.MustGetExampleParameterChangeProposal(suite.cdc) })
}
func TestCLITestSuite(t *testing.T) {
suite.Run(t, new(CLITestSuite))
}

View File

@ -49,7 +49,7 @@ func GetCmdSubmitProposal(cdc *codec.Codec) *cobra.Command {
The proposal file must be the json encoded forms of the proposal type you want to submit. The proposal file must be the json encoded forms of the proposal type you want to submit.
For example: For example:
%s %s
`, mustGetExampleParameterChangeProposal(cdc)), `, MustGetExampleParameterChangeProposal(cdc)),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
Example: fmt.Sprintf("%s tx %s submit-proposal 1 your-proposal.json", version.ClientName, types.ModuleName), Example: fmt.Sprintf("%s tx %s submit-proposal 1 your-proposal.json", version.ClientName, types.ModuleName),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
@ -139,7 +139,7 @@ For example, to create or update a committee:
and to delete a committee: and to delete a committee:
%s %s
`, mustGetExampleCommitteeChangeProposal(cdc), mustGetExampleCommitteeDeleteProposal(cdc)), `, MustGetExampleCommitteeChangeProposal(cdc), MustGetExampleCommitteeDeleteProposal(cdc)),
Args: cobra.ExactArgs(2), Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
txBldr := auth.NewTxBuilderFromCLI().WithTxEncoder(utils.GetTxEncoder(cdc)) txBldr := auth.NewTxBuilderFromCLI().WithTxEncoder(utils.GetTxEncoder(cdc))
@ -181,8 +181,8 @@ and to delete a committee:
return cmd return cmd
} }
// mustGetExampleCommitteeChangeProposal is a helper function to return an example json proposal // MustGetExampleCommitteeChangeProposal is a helper function to return an example json proposal
func mustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string { func MustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string {
exampleChangeProposal := types.NewCommitteeChangeProposal( exampleChangeProposal := types.NewCommitteeChangeProposal(
"A Title", "A Title",
"A description of this proposal.", "A description of this proposal.",
@ -206,8 +206,8 @@ func mustGetExampleCommitteeChangeProposal(cdc *codec.Codec) string {
return string(exampleChangeProposalBz) return string(exampleChangeProposalBz)
} }
// mustGetExampleCommitteeDeleteProposal is a helper function to return an example json proposal // MustGetExampleCommitteeDeleteProposal is a helper function to return an example json proposal
func mustGetExampleCommitteeDeleteProposal(cdc *codec.Codec) string { func MustGetExampleCommitteeDeleteProposal(cdc *codec.Codec) string {
exampleDeleteProposal := types.NewCommitteeDeleteProposal( exampleDeleteProposal := types.NewCommitteeDeleteProposal(
"A Title", "A Title",
"A description of this proposal.", "A description of this proposal.",
@ -220,8 +220,8 @@ func mustGetExampleCommitteeDeleteProposal(cdc *codec.Codec) string {
return string(exampleDeleteProposalBz) return string(exampleDeleteProposalBz)
} }
// mustGetExampleParameterChangeProposal is a helper function to return an example json proposal // MustGetExampleParameterChangeProposal is a helper function to return an example json proposal
func mustGetExampleParameterChangeProposal(cdc *codec.Codec) string { func MustGetExampleParameterChangeProposal(cdc *codec.Codec) string {
exampleParameterChangeProposal := params.NewParameterChangeProposal( exampleParameterChangeProposal := params.NewParameterChangeProposal(
"A Title", "A Title",
"A description of this proposal.", "A description of this proposal.",