fix: Fix Evidence CLI query flag parsing (#13458)

This commit is contained in:
Likhita Polavarapu 2022-11-02 23:55:53 +05:30 committed by GitHub
parent 3e2504510f
commit 709b4e2ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View File

@ -32,7 +32,6 @@ $ %s query %s --page=2 --limit=50
),
),
Args: cobra.MaximumNArgs(1),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: QueryEvidenceCmd(),
}

View File

@ -8,7 +8,6 @@ import (
"strings"
"testing"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
@ -17,6 +16,9 @@ import (
coretypes "github.com/tendermint/tendermint/rpc/core/types"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client/flags"
svrcmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
@ -99,6 +101,21 @@ func TestGetQueryCmd(t *testing.T) {
"evidence: []\npagination: null",
false,
},
"all evidence (json output)": {
[]string{
fmt.Sprintf("--%s=json", flags.FlagOutput),
},
func() client.Context {
bz, _ := encCfg.Codec.Marshal(&sdk.TxResponse{})
c := newMockTendermintRPC(abci.ResponseQuery{
Value: bz,
})
return baseCtx.WithClient(c)
},
"",
`{"evidence":[],"pagination":null}`,
false,
},
}
for name, tc := range testCases {