Skip to content

test: Implement address verification in TestKeysExport #1552

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

Merged
merged 1 commit into from
Apr 3, 2025
Merged
Changes from all commits
Commits
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
11 changes: 8 additions & 3 deletions cmd/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,12 @@ func TestKeysExport(t *testing.T) {
kr := keyring.NewInMemory(cdc)
require.NoError(t, kr.ImportPrivKey("temp", armorOut, keys.DefaultKeyPass))

// TODO: confirm the imported address matches?
// Retrieve the imported key's address and confirm it matches the expected address
info, err := kr.Key("temp")
require.NoError(t, err, "failed to retrieve imported key")
addr, err := info.GetAddress()
require.NoError(t, err, "failed to get address from imported key")
require.Equal(t, relayertest.ZeroCosmosAddr, addr.String(), "imported address does not match expected address")
}

func TestKeysDefaultCoinType(t *testing.T) {
Expand Down Expand Up @@ -248,7 +253,7 @@ func TestKeysRestoreAll_Delete(t *testing.T) {
res = sys.MustRun(t, "keys", "delete", "testChain2", "default", "-y")
require.Empty(t, res.Stdout.String())
require.Equal(t, res.Stderr.String(), "key default deleted\n")

res = sys.MustRun(t, "keys", "delete", "testChain3", "default", "-y")
require.Empty(t, res.Stdout.String())
require.Equal(t, res.Stderr.String(), "key default deleted\n")
Expand All @@ -265,4 +270,4 @@ func TestKeysRestoreAll_Delete(t *testing.T) {
res = sys.MustRun(t, "keys", "list", "testChain3")
require.Empty(t, res.Stdout.String())
require.Contains(t, res.Stderr.String(), "no keys found for chain testChain3")
}
}
Loading