Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix Evidence CLI query flag parsing #13458

Merged
merged 12 commits into from
Nov 2, 2022
Merged
1 change: 0 additions & 1 deletion x/evidence/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ $ %s query %s --page=2 --limit=50
),
),
Args: cobra.MaximumNArgs(1),
DisableFlagParsing: true,
SuggestionsMinimumDistance: 2,
RunE: QueryEvidenceCmd(),
}
Expand Down
19 changes: 18 additions & 1 deletion x/evidence/client/cli/tx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down