From d6f55a424837078373dd5f04b941e52c8ffc4832 Mon Sep 17 00:00:00 2001
From: Andrei Ivasko <cyberbono3@gmail.com>
Date: Tue, 30 Mar 2021 14:18:31 -0700
Subject: [PATCH] fix some tests

---
 client/keys/delete_test.go  | 6 ++++--
 client/keys/export_test.go  | 4 +++-
 client/keys/import_test.go  | 4 +++-
 client/keys/show_test.go    | 4 +++-
 testutil/network/network.go | 1 +
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/client/keys/delete_test.go b/client/keys/delete_test.go
index d5f8c1df30b5..e1687fc8d4b0 100644
--- a/client/keys/delete_test.go
+++ b/client/keys/delete_test.go
@@ -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)
 
@@ -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)
diff --git a/client/keys/export_test.go b/client/keys/export_test.go
index 782af754024f..4282d5d29b66 100644
--- a/client/keys/export_test.go
+++ b/client/keys/export_test.go
@@ -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))
diff --git a/client/keys/import_test.go b/client/keys/import_test.go
index 1c8d01cb162f..ea84408c2df5 100644
--- a/client/keys/import_test.go
+++ b/client/keys/import_test.go
@@ -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)
diff --git a/client/keys/show_test.go b/client/keys/show_test.go
index 9405a6f84b6f..60a70f3deb50 100644
--- a/client/keys/show_test.go
+++ b/client/keys/show_test.go
@@ -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"})
diff --git a/testutil/network/network.go b/testutil/network/network.go
index 2475e36e0486..d5421505be28 100644
--- a/testutil/network/network.go
+++ b/testutil/network/network.go
@@ -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).