@@ -43,13 +43,13 @@ func tmpDatadirWithKeystore(t *testing.T) string {
43
43
}
44
44
45
45
func TestAccountListEmpty (t * testing.T ) {
46
- geth := runGeth (t , "account" , "list" )
46
+ geth := runGeth (t , "--nousb" , " account" , "list" )
47
47
geth .ExpectExit ()
48
48
}
49
49
50
50
func TestAccountList (t * testing.T ) {
51
51
datadir := tmpDatadirWithKeystore (t )
52
- geth := runGeth (t , "account" , "list" , "--datadir" , datadir )
52
+ geth := runGeth (t , "--nousb" , " account" , "list" , "--datadir" , datadir )
53
53
defer geth .ExpectExit ()
54
54
if runtime .GOOS == "windows" {
55
55
geth .Expect (`
@@ -138,7 +138,7 @@ Fatal: Passwords do not match
138
138
139
139
func TestAccountUpdate (t * testing.T ) {
140
140
datadir := tmpDatadirWithKeystore (t )
141
- geth := runGeth (t , "account" , "update" ,
141
+ geth := runGeth (t , "--nousb" , " account" , "update" ,
142
142
"--datadir" , datadir , "--lightkdf" ,
143
143
"f466859ead1932d743d622cb74fc058882e8648a" )
144
144
defer geth .ExpectExit ()
@@ -153,7 +153,7 @@ Repeat password: {{.InputLine "foobar2"}}
153
153
}
154
154
155
155
func TestWalletImport (t * testing.T ) {
156
- geth := runGeth (t , "wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
156
+ geth := runGeth (t , "--nousb" , " wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
157
157
defer geth .ExpectExit ()
158
158
geth .Expect (`
159
159
!! Unsupported terminal, password will be echoed.
@@ -168,7 +168,7 @@ Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
168
168
}
169
169
170
170
func TestWalletImportBadPassword (t * testing.T ) {
171
- geth := runGeth (t , "wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
171
+ geth := runGeth (t , "--nousb" , " wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
172
172
defer geth .ExpectExit ()
173
173
geth .Expect (`
174
174
!! Unsupported terminal, password will be echoed.
@@ -178,11 +178,8 @@ Fatal: could not decrypt key with given password
178
178
}
179
179
180
180
func TestUnlockFlag (t * testing.T ) {
181
- datadir := tmpDatadirWithKeystore (t )
182
- geth := runGeth (t ,
183
- "--nat" , "none" , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "256" , "--ipcdisable" ,
184
- "--datadir" , datadir , "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
185
- "js" , "testdata/empty.js" )
181
+ geth := runMinimalGeth (t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore (t ),
182
+ "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" , "js" , "testdata/empty.js" )
186
183
geth .Expect (`
187
184
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
188
185
!! Unsupported terminal, password will be echoed.
@@ -202,10 +199,9 @@ Password: {{.InputLine "foobar"}}
202
199
}
203
200
204
201
func TestUnlockFlagWrongPassword (t * testing.T ) {
205
- datadir := tmpDatadirWithKeystore (t )
206
- geth := runGeth (t ,
207
- "--nat" , "none" , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "128" , "--ipcdisable" ,
208
- "--datadir" , datadir , "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
202
+ geth := runMinimalGeth (t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore (t ),
203
+ "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" , "js" , "testdata/empty.js" )
204
+
209
205
defer geth .ExpectExit ()
210
206
geth .Expect (`
211
207
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
@@ -221,10 +217,9 @@ Fatal: Failed to unlock account f466859ead1932d743d622cb74fc058882e8648a (could
221
217
222
218
// https://github.com/ethereum/go-ethereum/issues/1785
223
219
func TestUnlockFlagMultiIndex (t * testing.T ) {
224
- datadir := tmpDatadirWithKeystore (t )
225
- geth := runGeth (t ,
226
- "--nat" , "none" , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "128" , "--ipcdisable" ,
227
- "--datadir" , datadir , "--unlock" , "0,2" , "js" , "testdata/empty.js" )
220
+ geth := runMinimalGeth (t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore (t ),
221
+ "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" , "--unlock" , "0,2" , "js" , "testdata/empty.js" )
222
+
228
223
geth .Expect (`
229
224
Unlocking account 0 | Attempt 1/3
230
225
!! Unsupported terminal, password will be echoed.
@@ -247,11 +242,9 @@ Password: {{.InputLine "foobar"}}
247
242
}
248
243
249
244
func TestUnlockFlagPasswordFile (t * testing.T ) {
250
- datadir := tmpDatadirWithKeystore (t )
251
- geth := runGeth (t ,
252
- "--nat" , "none" , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "128" , "--ipcdisable" ,
253
- "--datadir" , datadir , "--password" , "testdata/passwords.txt" , "--unlock" , "0,2" ,
254
- "js" , "testdata/empty.js" )
245
+ geth := runMinimalGeth (t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore (t ),
246
+ "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" , "--password" , "testdata/passwords.txt" , "--unlock" , "0,2" , "js" , "testdata/empty.js" )
247
+
255
248
geth .ExpectExit ()
256
249
257
250
wantMessages := []string {
@@ -267,10 +260,9 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
267
260
}
268
261
269
262
func TestUnlockFlagPasswordFileWrongPassword (t * testing.T ) {
270
- datadir := tmpDatadirWithKeystore (t )
271
- geth := runGeth (t ,
272
- "--nat" , "none" , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "128" , "--ipcdisable" ,
273
- "--datadir" , datadir , "--password" , "testdata/wrong-passwords.txt" , "--unlock" , "0,2" )
263
+ geth := runMinimalGeth (t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore (t ),
264
+ "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" , "--password" ,
265
+ "testdata/wrong-passwords.txt" , "--unlock" , "0,2" )
274
266
defer geth .ExpectExit ()
275
267
geth .Expect (`
276
268
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)
279
271
280
272
func TestUnlockFlagAmbiguous (t * testing.T ) {
281
273
store := filepath .Join (".." , ".." , "accounts" , "keystore" , "testdata" , "dupes" )
282
- geth := runGeth ( t ,
283
- "--nat " , "none " , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "128" , "--ipcdisable " ,
284
- "--keystore" , store , "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
274
+ geth := runMinimalGeth ( t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore ( t ) ,
275
+ "--unlock " , "f466859ead1932d743d622cb74fc058882e8648a " , "--keystore " ,
276
+ store , "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
285
277
"js" , "testdata/empty.js" )
286
278
defer geth .ExpectExit ()
287
279
@@ -317,9 +309,10 @@ In order to avoid this warning, you need to remove the following duplicate key f
317
309
318
310
func TestUnlockFlagAmbiguousWrongPassword (t * testing.T ) {
319
311
store := filepath .Join (".." , ".." , "accounts" , "keystore" , "testdata" , "dupes" )
320
- geth := runGeth (t ,
321
- "--nat" , "none" , "--nodiscover" , "--maxpeers" , "0" , "--port" , "0" , "--nousb" , "--cache" , "128" , "--ipcdisable" ,
322
- "--keystore" , store , "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
312
+ geth := runMinimalGeth (t , "--port" , "0" , "--ipcdisable" , "--datadir" , tmpDatadirWithKeystore (t ),
313
+ "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" , "--keystore" ,
314
+ store , "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
315
+
323
316
defer geth .ExpectExit ()
324
317
325
318
// Helper for the expect template, returns absolute keystore path.
0 commit comments