From fd98a9194ac73a53043ab092ea183a1b61f3e473 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Wed, 2 Sep 2020 13:17:13 +0300 Subject: [PATCH] cli: add tests for `wallet dump` --- cli/wallet_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cli/wallet_test.go b/cli/wallet_test.go index 8973eb7ad..b2707f257 100644 --- a/cli/wallet_test.go +++ b/cli/wallet_test.go @@ -2,6 +2,7 @@ package main import ( "encoding/hex" + "encoding/json" "math/big" "os" "path" @@ -253,3 +254,15 @@ func TestImportDeployed(t *testing.T) { require.Equal(t, big.NewInt(1), b) }) } + +func TestWalletDump(t *testing.T) { + e := newExecutor(t, false) + defer e.Close(t) + + e.Run(t, "neo-go", "wallet", "dump", "--wallet", "testdata/testwallet.json") + rawStr := strings.TrimSpace(e.Out.String()) + w := new(wallet.Wallet) + require.NoError(t, json.Unmarshal([]byte(rawStr), w)) + require.Equal(t, 1, len(w.Accounts)) + require.Equal(t, "NNuJqXDnRqvwgzhSzhH4jnVFWB1DyZ34EM", w.Accounts[0].Address) +}