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

chore!: Refactor x/bank CLI Tests #12706

Merged
merged 34 commits into from
Aug 3, 2022
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ef0afe1
updates
alexanderbez Jul 24, 2022
136e0c9
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 24, 2022
c4f5a6c
updates
alexanderbez Jul 25, 2022
c4d01b3
updates
alexanderbez Jul 25, 2022
045b142
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 25, 2022
4b9b40b
updates
alexanderbez Jul 25, 2022
28688f0
updates
alexanderbez Jul 25, 2022
5447530
updates
alexanderbez Jul 25, 2022
9d61e4c
updates
alexanderbez Jul 26, 2022
b229234
updates
alexanderbez Jul 26, 2022
dd6e1f4
updates
alexanderbez Jul 26, 2022
1484c8e
updates
alexanderbez Jul 26, 2022
5a209d1
updates
alexanderbez Jul 26, 2022
133d732
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 26, 2022
b2364c2
updates
alexanderbez Jul 27, 2022
3f94e2e
Merge branch 'bez/12696-x-bank-cli-tests-refactor' of github.com:cosm…
alexanderbez Jul 27, 2022
883e6da
updates
alexanderbez Jul 27, 2022
7350035
updates
alexanderbez Jul 27, 2022
a58abf2
updates
alexanderbez Jul 27, 2022
1ff43e4
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 27, 2022
f5b8eb1
updates
alexanderbez Jul 27, 2022
fdb1974
updates
alexanderbez Jul 27, 2022
cfd48d5
updates
alexanderbez Jul 28, 2022
a3e3857
updates
alexanderbez Jul 28, 2022
0333304
updates
alexanderbez Jul 28, 2022
1d51689
updates
alexanderbez Jul 28, 2022
004d979
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 28, 2022
d2b1844
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 28, 2022
ae0f2be
updates
alexanderbez Jul 28, 2022
f0d4ba8
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 29, 2022
6e13bf3
Merge branch 'main' into bez/12696-x-bank-cli-tests-refactor
alexanderbez Jul 30, 2022
fc4f732
Update client/query.go
alexanderbez Aug 1, 2022
f89840a
updates
alexanderbez Aug 3, 2022
9235038
updates
alexanderbez Aug 3, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updates
  • Loading branch information
alexanderbez committed Jul 27, 2022
commit fdb1974f1de6a019955344ea6727c2853403e96c
45 changes: 45 additions & 0 deletions x/bank/client/testutil/cli_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Note, these utility functions are remaining in this file because they are needed
by other legacy CLI test suites. Once those test suites are migrated and refactored
per https://github.com/cosmos/cosmos-sdk/issues/12696, then this package should
be entirely removed.
*/
package testutil

import (
"fmt"

"github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/testutil"
clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
bankcli "github.com/cosmos/cosmos-sdk/x/bank/client/cli"
)

func MsgSendExec(clientCtx client.Context, from, to, amount fmt.Stringer, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{from.String(), to.String(), amount.String()}
args = append(args, extraArgs...)

return clitestutil.ExecTestCLICmd(clientCtx, bankcli.NewSendTxCmd(), args)
}

func MsgMultiSendExec(clientCtx client.Context, from sdk.AccAddress, to []sdk.AccAddress, amount fmt.Stringer, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{from.String()}
for _, addr := range to {
args = append(args, addr.String())
}

args = append(args, amount.String())
args = append(args, extraArgs...)

return clitestutil.ExecTestCLICmd(clientCtx, bankcli.NewMultiSendTxCmd(), args)
}

func QueryBalancesExec(clientCtx client.Context, address fmt.Stringer, extraArgs ...string) (testutil.BufferWriter, error) {
args := []string{address.String(), fmt.Sprintf("--%s=json", cli.OutputFlag)}
args = append(args, extraArgs...)

return clitestutil.ExecTestCLICmd(clientCtx, bankcli.GetBalancesCmd(), args)
}