|
|
@ -43,13 +43,13 @@ func tmpDatadirWithKeystore(t *testing.T) string { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestAccountListEmpty(t *testing.T) { |
|
|
|
func TestAccountListEmpty(t *testing.T) { |
|
|
|
geth := runGeth(t, "account", "list") |
|
|
|
geth := runGeth(t, "--nousb", "account", "list") |
|
|
|
geth.ExpectExit() |
|
|
|
geth.ExpectExit() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestAccountList(t *testing.T) { |
|
|
|
func TestAccountList(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runGeth(t, "account", "list", "--datadir", datadir) |
|
|
|
geth := runGeth(t, "--nousb", "account", "list", "--datadir", datadir) |
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
if runtime.GOOS == "windows" { |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
@ -138,7 +138,7 @@ Fatal: Passwords do not match |
|
|
|
|
|
|
|
|
|
|
|
func TestAccountUpdate(t *testing.T) { |
|
|
|
func TestAccountUpdate(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runGeth(t, "account", "update", |
|
|
|
geth := runGeth(t, "--nousb", "account", "update", |
|
|
|
"--datadir", datadir, "--lightkdf", |
|
|
|
"--datadir", datadir, "--lightkdf", |
|
|
|
"f466859ead1932d743d622cb74fc058882e8648a") |
|
|
|
"f466859ead1932d743d622cb74fc058882e8648a") |
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
@ -153,7 +153,7 @@ Repeat password: {{.InputLine "foobar2"}} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestWalletImport(t *testing.T) { |
|
|
|
func TestWalletImport(t *testing.T) { |
|
|
|
geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json") |
|
|
|
geth := runGeth(t, "--nousb", "wallet", "import", "--lightkdf", "testdata/guswallet.json") |
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
@ -168,7 +168,7 @@ Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestWalletImportBadPassword(t *testing.T) { |
|
|
|
func TestWalletImportBadPassword(t *testing.T) { |
|
|
|
geth := runGeth(t, "wallet", "import", "--lightkdf", "testdata/guswallet.json") |
|
|
|
geth := runGeth(t, "--nousb", "wallet", "import", "--lightkdf", "testdata/guswallet.json") |
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
@ -178,11 +178,8 @@ Fatal: could not decrypt key with given password |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlag(t *testing.T) { |
|
|
|
func TestUnlockFlag(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runGeth(t, |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "js", "testdata/empty.js") |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "256", "--ipcdisable", |
|
|
|
|
|
|
|
"--datadir", datadir, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", |
|
|
|
|
|
|
|
"js", "testdata/empty.js") |
|
|
|
|
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 |
|
|
|
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
@ -202,10 +199,9 @@ Password: {{.InputLine "foobar"}} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagWrongPassword(t *testing.T) { |
|
|
|
func TestUnlockFlagWrongPassword(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runGeth(t, |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "js", "testdata/empty.js") |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "128", "--ipcdisable", |
|
|
|
|
|
|
|
"--datadir", datadir, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a") |
|
|
|
|
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 |
|
|
|
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3 |
|
|
@ -221,10 +217,9 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/ethereum/go-ethereum/issues/1785
|
|
|
|
// https://github.com/ethereum/go-ethereum/issues/1785
|
|
|
|
func TestUnlockFlagMultiIndex(t *testing.T) { |
|
|
|
func TestUnlockFlagMultiIndex(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runGeth(t, |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--unlock", "0,2", "js", "testdata/empty.js") |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "128", "--ipcdisable", |
|
|
|
|
|
|
|
"--datadir", datadir, "--unlock", "0,2", "js", "testdata/empty.js") |
|
|
|
|
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
Unlocking account 0 | Attempt 1/3 |
|
|
|
Unlocking account 0 | Attempt 1/3 |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
|
!! Unsupported terminal, password will be echoed. |
|
|
@ -247,11 +242,9 @@ Password: {{.InputLine "foobar"}} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagPasswordFile(t *testing.T) { |
|
|
|
func TestUnlockFlagPasswordFile(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runGeth(t, |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", "testdata/passwords.txt", "--unlock", "0,2", "js", "testdata/empty.js") |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "128", "--ipcdisable", |
|
|
|
|
|
|
|
"--datadir", datadir, "--password", "testdata/passwords.txt", "--unlock", "0,2", |
|
|
|
|
|
|
|
"js", "testdata/empty.js") |
|
|
|
|
|
|
|
geth.ExpectExit() |
|
|
|
geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
|
wantMessages := []string{ |
|
|
|
wantMessages := []string{ |
|
|
@ -267,10 +260,9 @@ func TestUnlockFlagPasswordFile(t *testing.T) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) { |
|
|
|
func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) { |
|
|
|
datadir := tmpDatadirWithKeystore(t) |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
geth := runGeth(t, |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--password", |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "128", "--ipcdisable", |
|
|
|
"testdata/wrong-passwords.txt", "--unlock", "0,2") |
|
|
|
"--datadir", datadir, "--password", "testdata/wrong-passwords.txt", "--unlock", "0,2") |
|
|
|
|
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
geth.Expect(` |
|
|
|
geth.Expect(` |
|
|
|
Fatal: Failed to unlock account 0 (could not decrypt key with given password) |
|
|
|
Fatal: Failed to unlock account 0 (could not decrypt key with given password) |
|
|
@ -279,9 +271,9 @@ Fatal: Failed to unlock account 0 (could not decrypt key with given password) |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagAmbiguous(t *testing.T) { |
|
|
|
func TestUnlockFlagAmbiguous(t *testing.T) { |
|
|
|
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") |
|
|
|
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") |
|
|
|
geth := runGeth(t, |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "128", "--ipcdisable", |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore", |
|
|
|
"--keystore", store, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", |
|
|
|
store, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a", |
|
|
|
"js", "testdata/empty.js") |
|
|
|
"js", "testdata/empty.js") |
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
@ -317,9 +309,10 @@ In order to avoid this warning, you need to remove the following duplicate key f |
|
|
|
|
|
|
|
|
|
|
|
func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) { |
|
|
|
func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) { |
|
|
|
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") |
|
|
|
store := filepath.Join("..", "..", "accounts", "keystore", "testdata", "dupes") |
|
|
|
geth := runGeth(t, |
|
|
|
geth := runMinimalGeth(t, "--port", "0", "--ipcdisable", "--datadir", tmpDatadirWithKeystore(t), |
|
|
|
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--port", "0", "--nousb", "--cache", "128", "--ipcdisable", |
|
|
|
"--unlock", "f466859ead1932d743d622cb74fc058882e8648a", "--keystore", |
|
|
|
"--keystore", store, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a") |
|
|
|
store, "--unlock", "f466859ead1932d743d622cb74fc058882e8648a") |
|
|
|
|
|
|
|
|
|
|
|
defer geth.ExpectExit() |
|
|
|
defer geth.ExpectExit() |
|
|
|
|
|
|
|
|
|
|
|
// Helper for the expect template, returns absolute keystore path.
|
|
|
|
// Helper for the expect template, returns absolute keystore path.
|
|
|
|