cli: add tests for wallet dump

This commit is contained in:
Evgenii Stratonikov 2020-09-02 13:17:13 +03:00
parent 40a24bad64
commit fd98a9194a

View file

@ -2,6 +2,7 @@ package main
import ( import (
"encoding/hex" "encoding/hex"
"encoding/json"
"math/big" "math/big"
"os" "os"
"path" "path"
@ -253,3 +254,15 @@ func TestImportDeployed(t *testing.T) {
require.Equal(t, big.NewInt(1), b) 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)
}