Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberbono3 committed Mar 30, 2021
1 parent 32b2d15 commit d6f55a4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
6 changes: 4 additions & 2 deletions client/keys/delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func Test_runDeleteCmd(t *testing.T) {

path := sdk.GetConfig().GetFullBIP44Path()

cmd.SetArgs([]string{"blah", fmt.Sprintf("--%s=%s", flags.FlagHome, kbHome)})
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn)
require.NoError(t, err)

Expand All @@ -42,9 +43,10 @@ func Test_runDeleteCmd(t *testing.T) {
_, _, err = kb.NewMnemonic(fakeKeyName2, keyring.English, sdk.FullFundraiserPath, keyring.DefaultBIP39Passphrase, hd.Secp256k1)
require.NoError(t, err)

cmd.SetArgs([]string{"blah", fmt.Sprintf("--%s=%s", flags.FlagHome, kbHome)})
clientCtx := client.Context{}.
WithKeyringDir(kbHome).
WithKeyring(kb)

clientCtx := client.Context{}.WithKeyring(kb)
ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx)

err = cmd.ExecuteContext(ctx)
Expand Down
4 changes: 3 additions & 1 deletion client/keys/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ func Test_runExportCmd(t *testing.T) {
mockIn.Reset("123456789\n123456789\n")
cmd.SetArgs(args)

clientCtx := client.Context{}.WithKeyring(kb)
clientCtx := client.Context{}.
WithKeyringDir(kbHome).
WithKeyring(kb)
ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx)

require.NoError(t, cmd.ExecuteContext(ctx))
Expand Down
4 changes: 3 additions & 1 deletion client/keys/import_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func Test_runImportCmd(t *testing.T) {
kbHome := t.TempDir()
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn)

clientCtx := client.Context{}.WithKeyring(kb)
clientCtx := client.Context{}.
WithKeyringDir(kbHome).
WithKeyring(kb)
ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx)

require.NoError(t, err)
Expand Down
4 changes: 3 additions & 1 deletion client/keys/show_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func Test_runShowCmd(t *testing.T) {
kb, err := keyring.New(sdk.KeyringServiceName(), keyring.BackendTest, kbHome, mockIn)
require.NoError(t, err)

clientCtx := client.Context{}.WithKeyring(kb)
clientCtx := client.Context{}.
WithKeyringDir(kbHome).
WithKeyring(kb)
ctx := context.WithValue(context.Background(), client.ClientContextKey, &clientCtx)

cmd.SetArgs([]string{"invalid"})
Expand Down
1 change: 1 addition & 0 deletions testutil/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ func New(t *testing.T, cfg Config) *Network {
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appCfg)

clientCtx := client.Context{}.
WithKeyringDir(clientDir).
WithKeyring(kb).
WithHomeDir(tmCfg.RootDir).
WithChainID(cfg.ChainID).
Expand Down

0 comments on commit d6f55a4

Please sign in to comment.