cli: add tests for wallet remove

This commit is contained in:
Evgenii Stratonikov 2020-09-01 15:10:45 +03:00
parent 4c00b26fb8
commit 59157724e3

View file

@ -31,10 +31,22 @@ func TestWalletInit(t *testing.T) {
w, err := wallet.NewWalletFromFile(walletPath) w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err) require.NoError(t, err)
defer w.Close()
require.Len(t, w.Accounts, 1) require.Len(t, w.Accounts, 1)
require.Equal(t, w.Accounts[0].Label, "testname") require.Equal(t, w.Accounts[0].Label, "testname")
require.NoError(t, w.Accounts[0].Decrypt("testpass")) require.NoError(t, w.Accounts[0].Decrypt("testpass"))
w.Close()
t.Run("RemoveAccount", func(t *testing.T) {
sh := w.Accounts[0].Contract.ScriptHash()
addr := w.Accounts[0].Address
e.In.WriteString("y\r")
e.Run(t, "neo-go", "wallet", "remove",
"--wallet", walletPath, addr)
w, err := wallet.NewWalletFromFile(walletPath)
require.NoError(t, err)
require.Nil(t, w.GetAccount(sh))
w.Close()
})
}) })
t.Run("Import", func(t *testing.T) { t.Run("Import", func(t *testing.T) {