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

x/auth: in-process test refactor #6573

Merged
merged 71 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9a02e1a
remove unused functions
jgimeno Jul 1, 2020
55cabc9
create helper func to send tx
jgimeno Jul 1, 2020
3c5dec4
refactor to use test help to send tx by client
jgimeno Jul 1, 2020
e78c747
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 2, 2020
e8242f0
Commit before getting backend.
jgimeno Jul 2, 2020
c40e293
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 2, 2020
836b685
Temporal commit
jgimeno Jul 3, 2020
2827d29
temp commit
jgimeno Jul 3, 2020
b5f89c7
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 8, 2020
5376b5f
remove the creation of txbuilder from cli
jgimeno Jul 8, 2020
0a6690f
fix imports
jgimeno Jul 8, 2020
204aa71
update changelog
jgimeno Jul 8, 2020
db8bc87
Merge branch 'master' into jonathan/tx-builder
jgimeno Jul 8, 2020
58774c3
Remove unused function.
jgimeno Jul 8, 2020
772733e
Merge branch 'jonathan/tx-builder' of github.com:cosmos/cosmos-sdk in…
jgimeno Jul 8, 2020
da4f432
Merge branch 'jonathan/tx-builder' into jonathan/auth-module-inproces…
jgimeno Jul 9, 2020
af47525
Add flag home into tx sign command.
jgimeno Jul 9, 2020
c4ff30e
Merge branch 'jonathan/tx-builder' into jonathan/auth-module-inproces…
jgimeno Jul 9, 2020
3962c82
migrade TestCLIValidateSignatures to use new test suite
jgimeno Jul 9, 2020
f46f8ea
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 9, 2020
54a84a6
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 9, 2020
47767d6
migrate test one
jgimeno Jul 9, 2020
ea95899
Add changes to make sign batch.
jgimeno Jul 9, 2020
8c7958c
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 10, 2020
f0c22e5
make test pass
jgimeno Jul 10, 2020
1e9e3e2
refactor common logic
jgimeno Jul 10, 2020
dbe63bd
First part of cli sign.
jgimeno Jul 10, 2020
604a936
Add test for sign batch.
jgimeno Jul 10, 2020
69024ab
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 10, 2020
c91d2e5
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
Jul 10, 2020
0f26ab0
refactor a little and improve the test
jgimeno Jul 10, 2020
03197b4
Merge branch 'jonathan/auth-module-inprocess-integration-test' of git…
jgimeno Jul 10, 2020
6670230
migrate broadcast command
jgimeno Jul 10, 2020
4fc0031
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
Jul 10, 2020
ff460e8
fix linter
jgimeno Jul 10, 2020
bfd58dd
Merge branch 'jonathan/auth-module-inprocess-integration-test' of git…
jgimeno Jul 10, 2020
3bab3e5
Remove printf for debug in bank module.
jgimeno Jul 10, 2020
5006376
Fix unused err var.
jgimeno Jul 10, 2020
3a86663
fix linter
jgimeno Jul 10, 2020
ebe54b8
fix test
jgimeno Jul 10, 2020
21810a5
fix tests client
jgimeno Jul 10, 2020
7046e76
Fix linter.
jgimeno Jul 10, 2020
286492c
Temp commit signature.
jgimeno Jul 13, 2020
8e9a1d5
encode tx
jgimeno Jul 13, 2020
9f96ef9
migrate tests
jgimeno Jul 13, 2020
1a755a3
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 13, 2020
67805a4
Fix imports.
jgimeno Jul 13, 2020
4973b9a
Remove changelog
jgimeno Jul 13, 2020
1f4db6e
fix tests
jgimeno Jul 13, 2020
54fa3cc
Fix tests.
jgimeno Jul 13, 2020
a3f7647
Update x/bank/client/testutil/cli_helpers.go
Jul 13, 2020
61ad3cf
Remove alias.
jgimeno Jul 13, 2020
1bf0a90
Merge branch 'jonathan/auth-module-inprocess-integration-test' of git…
jgimeno Jul 13, 2020
af3a0f2
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
fedekunze Jul 13, 2020
57baa45
Remove wait for N block func.
jgimeno Jul 13, 2020
b7604f5
Merge branch 'jonathan/auth-module-inprocess-integration-test' of git…
jgimeno Jul 13, 2020
b9667fe
export callCmd function into its own file.
jgimeno Jul 13, 2020
7bf3912
fix imports
jgimeno Jul 13, 2020
9fba248
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 13, 2020
72debd9
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
alexanderbez Jul 14, 2020
a1997f0
bring back to inner functions
jgimeno Jul 14, 2020
8523e71
Merge branch 'jonathan/auth-module-inprocess-integration-test' of git…
jgimeno Jul 14, 2020
9138048
apply mock io
jgimeno Jul 14, 2020
bae1521
the helpers use mockio
jgimeno Jul 14, 2020
6a35ee9
fix bug
jgimeno Jul 14, 2020
45374fb
Add Helpers.
jgimeno Jul 14, 2020
4a05e9c
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 14, 2020
16bf27f
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 14, 2020
dded545
return to put the function in testutil package
jgimeno Jul 14, 2020
8616606
return BufferWriter in ExecTestCLICmd
jgimeno Jul 14, 2020
4e9e0e3
Merge branch 'master' into jonathan/auth-module-inprocess-integration…
jgimeno Jul 14, 2020
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
14 changes: 7 additions & 7 deletions simapp/simd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,14 @@ func txCommand() *cobra.Command {
}

cmd.AddCommand(
authcmd.GetSignCommand(initClientCtx),
authcmd.GetSignBatchCommand(encodingConfig.Amino),
authcmd.GetMultiSignCommand(initClientCtx),
authcmd.GetValidateSignaturesCommand(initClientCtx),
authcmd.GetSignCommand(),
authcmd.GetSignBatchCommand(),
authcmd.GetMultiSignCommand(),
authcmd.GetValidateSignaturesCommand(),
flags.LineBreak,
authcmd.GetBroadcastCommand(initClientCtx),
authcmd.GetEncodeCommand(initClientCtx),
authcmd.GetDecodeCommand(initClientCtx),
authcmd.GetBroadcastCommand(),
authcmd.GetEncodeCommand(),
authcmd.GetDecodeCommand(),
flags.LineBreak,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/cli/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func AddFlags(cmd string, flags []string) string {
return strings.TrimSpace(cmd)
}

func UnmarshalStdTx(t require.TestingT, c *codec.Codec, s string) (stdTx authtypes.StdTx) {
func UnmarshalStdTx(t require.TestingT, c codec.JSONMarshaler, s string) (stdTx authtypes.StdTx) {
require.Nil(t, c.UnmarshalJSON([]byte(s), &stdTx))
return
}
Expand Down
27 changes: 27 additions & 0 deletions testutil/cli/cmd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cli

import (
"context"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/testutil"
)

// ExecTestCLICmd builds the client context, mocks the output and executes the command.
func ExecTestCLICmd(clientCtx client.Context, cmd *cobra.Command, extraArgs []string) (testutil.BufferWriter, error) {
cmd.SetArgs(extraArgs)

_, out := testutil.ApplyMockIO(cmd)
clientCtx = clientCtx.WithOutput(out)

ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, &clientCtx)

if err := cmd.ExecuteContext(ctx); err != nil {
return out, err
}

return out, nil
}
2 changes: 1 addition & 1 deletion testutil/ioutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func ApplyMockIODiscardOutErr(c *cobra.Command) BufferReader {
// the caller must call to remove the file when it is
// no longer needed.
func WriteToNewTempFile(t testing.TB, s string) (*os.File, func()) {
fp, err := ioutil.TempFile("", t.Name()+"_")
fp, err := ioutil.TempFile("", strings.ReplaceAll(t.Name(), "/", "_")+"_")
jgimeno marked this conversation as resolved.
Show resolved Hide resolved
require.Nil(t, err)

_, err = fp.WriteString(s)
Expand Down
4 changes: 2 additions & 2 deletions x/auth/client/cli/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// GetBroadcastCommand returns the tx broadcast command.
func GetBroadcastCommand(clientCtx client.Context) *cobra.Command {
func GetBroadcastCommand() *cobra.Command {
cmd := &cobra.Command{
Use: "broadcast [file_path]",
Short: "Broadcast transactions generated offline",
Expand All @@ -25,7 +25,7 @@ $ <appcli> tx broadcast ./mytxn.json
`),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx = clientCtx.Init()
clientCtx := client.GetClientContextFromCmd(cmd)

if offline, _ := cmd.Flags().GetBool(flags.FlagOffline); offline {
return errors.New("cannot broadcast tx during offline mode")
Expand Down
46 changes: 0 additions & 46 deletions x/auth/client/cli/broadcast_test.go

This file was deleted.

Loading