@@ -44,21 +44,21 @@ func tmpDatadirWithKeystore(t *testing.T) string {
44
44
45
45
func TestAccountListEmpty (t * testing.T ) {
46
46
geth := runGeth (t , "account" , "list" )
47
- geth .expectExit ()
47
+ geth .ExpectExit ()
48
48
}
49
49
50
50
func TestAccountList (t * testing.T ) {
51
51
datadir := tmpDatadirWithKeystore (t )
52
52
geth := runGeth (t , "account" , "list" , "--datadir" , datadir )
53
- defer geth .expectExit ()
53
+ defer geth .ExpectExit ()
54
54
if runtime .GOOS == "windows" {
55
- geth .expect (`
55
+ geth .Expect (`
56
56
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
57
57
Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}\keystore\aaa
58
58
Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}\keystore\zzz
59
59
` )
60
60
} else {
61
- geth .expect (`
61
+ geth .Expect (`
62
62
Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
63
63
Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}/keystore/aaa
64
64
Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/keystore/zzz
@@ -68,20 +68,20 @@ Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/k
68
68
69
69
func TestAccountNew (t * testing.T ) {
70
70
geth := runGeth (t , "account" , "new" , "--lightkdf" )
71
- defer geth .expectExit ()
72
- geth .expect (`
71
+ defer geth .ExpectExit ()
72
+ geth .Expect (`
73
73
Your new account is locked with a password. Please give a password. Do not forget this password.
74
74
!! Unsupported terminal, password will be echoed.
75
75
Passphrase: {{.InputLine "foobar"}}
76
76
Repeat passphrase: {{.InputLine "foobar"}}
77
77
` )
78
- geth .expectRegexp (`Address: \{[0-9a-f]{40}\}\n` )
78
+ geth .ExpectRegexp (`Address: \{[0-9a-f]{40}\}\n` )
79
79
}
80
80
81
81
func TestAccountNewBadRepeat (t * testing.T ) {
82
82
geth := runGeth (t , "account" , "new" , "--lightkdf" )
83
- defer geth .expectExit ()
84
- geth .expect (`
83
+ defer geth .ExpectExit ()
84
+ geth .Expect (`
85
85
Your new account is locked with a password. Please give a password. Do not forget this password.
86
86
!! Unsupported terminal, password will be echoed.
87
87
Passphrase: {{.InputLine "something"}}
@@ -95,8 +95,8 @@ func TestAccountUpdate(t *testing.T) {
95
95
geth := runGeth (t , "account" , "update" ,
96
96
"--datadir" , datadir , "--lightkdf" ,
97
97
"f466859ead1932d743d622cb74fc058882e8648a" )
98
- defer geth .expectExit ()
99
- geth .expect (`
98
+ defer geth .ExpectExit ()
99
+ geth .Expect (`
100
100
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
101
101
!! Unsupported terminal, password will be echoed.
102
102
Passphrase: {{.InputLine "foobar"}}
@@ -108,8 +108,8 @@ Repeat passphrase: {{.InputLine "foobar2"}}
108
108
109
109
func TestWalletImport (t * testing.T ) {
110
110
geth := runGeth (t , "wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
111
- defer geth .expectExit ()
112
- geth .expect (`
111
+ defer geth .ExpectExit ()
112
+ geth .Expect (`
113
113
!! Unsupported terminal, password will be echoed.
114
114
Passphrase: {{.InputLine "foo"}}
115
115
Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
@@ -123,8 +123,8 @@ Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
123
123
124
124
func TestWalletImportBadPassword (t * testing.T ) {
125
125
geth := runGeth (t , "wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
126
- defer geth .expectExit ()
127
- geth .expect (`
126
+ defer geth .ExpectExit ()
127
+ geth .Expect (`
128
128
!! Unsupported terminal, password will be echoed.
129
129
Passphrase: {{.InputLine "wrong"}}
130
130
Fatal: could not decrypt key with given passphrase
@@ -137,19 +137,19 @@ func TestUnlockFlag(t *testing.T) {
137
137
"--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
138
138
"--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
139
139
"js" , "testdata/empty.js" )
140
- geth .expect (`
140
+ geth .Expect (`
141
141
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
142
142
!! Unsupported terminal, password will be echoed.
143
143
Passphrase: {{.InputLine "foobar"}}
144
144
` )
145
- geth .expectExit ()
145
+ geth .ExpectExit ()
146
146
147
147
wantMessages := []string {
148
148
"Unlocked account" ,
149
149
"=0xf466859ead1932d743d622cb74fc058882e8648a" ,
150
150
}
151
151
for _ , m := range wantMessages {
152
- if ! strings .Contains (geth .stderrText (), m ) {
152
+ if ! strings .Contains (geth .StderrText (), m ) {
153
153
t .Errorf ("stderr text does not contain %q" , m )
154
154
}
155
155
}
@@ -160,8 +160,8 @@ func TestUnlockFlagWrongPassword(t *testing.T) {
160
160
geth := runGeth (t ,
161
161
"--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
162
162
"--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
163
- defer geth .expectExit ()
164
- geth .expect (`
163
+ defer geth .ExpectExit ()
164
+ geth .Expect (`
165
165
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
166
166
!! Unsupported terminal, password will be echoed.
167
167
Passphrase: {{.InputLine "wrong1"}}
@@ -180,22 +180,22 @@ func TestUnlockFlagMultiIndex(t *testing.T) {
180
180
"--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
181
181
"--unlock" , "0,2" ,
182
182
"js" , "testdata/empty.js" )
183
- geth .expect (`
183
+ geth .Expect (`
184
184
Unlocking account 0 | Attempt 1/3
185
185
!! Unsupported terminal, password will be echoed.
186
186
Passphrase: {{.InputLine "foobar"}}
187
187
Unlocking account 2 | Attempt 1/3
188
188
Passphrase: {{.InputLine "foobar"}}
189
189
` )
190
- geth .expectExit ()
190
+ geth .ExpectExit ()
191
191
192
192
wantMessages := []string {
193
193
"Unlocked account" ,
194
194
"=0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8" ,
195
195
"=0x289d485d9771714cce91d3393d764e1311907acc" ,
196
196
}
197
197
for _ , m := range wantMessages {
198
- if ! strings .Contains (geth .stderrText (), m ) {
198
+ if ! strings .Contains (geth .StderrText (), m ) {
199
199
t .Errorf ("stderr text does not contain %q" , m )
200
200
}
201
201
}
@@ -207,15 +207,15 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
207
207
"--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
208
208
"--password" , "testdata/passwords.txt" , "--unlock" , "0,2" ,
209
209
"js" , "testdata/empty.js" )
210
- geth .expectExit ()
210
+ geth .ExpectExit ()
211
211
212
212
wantMessages := []string {
213
213
"Unlocked account" ,
214
214
"=0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8" ,
215
215
"=0x289d485d9771714cce91d3393d764e1311907acc" ,
216
216
}
217
217
for _ , m := range wantMessages {
218
- if ! strings .Contains (geth .stderrText (), m ) {
218
+ if ! strings .Contains (geth .StderrText (), m ) {
219
219
t .Errorf ("stderr text does not contain %q" , m )
220
220
}
221
221
}
@@ -226,8 +226,8 @@ func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) {
226
226
geth := runGeth (t ,
227
227
"--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
228
228
"--password" , "testdata/wrong-passwords.txt" , "--unlock" , "0,2" )
229
- defer geth .expectExit ()
230
- geth .expect (`
229
+ defer geth .ExpectExit ()
230
+ geth .Expect (`
231
231
Fatal: Failed to unlock account 0 (could not decrypt key with given passphrase)
232
232
` )
233
233
}
@@ -238,14 +238,14 @@ func TestUnlockFlagAmbiguous(t *testing.T) {
238
238
"--keystore" , store , "--nat" , "none" , "--nodiscover" , "--dev" ,
239
239
"--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
240
240
"js" , "testdata/empty.js" )
241
- defer geth .expectExit ()
241
+ defer geth .ExpectExit ()
242
242
243
243
// Helper for the expect template, returns absolute keystore path.
244
- geth .setTemplateFunc ("keypath" , func (file string ) string {
244
+ geth .SetTemplateFunc ("keypath" , func (file string ) string {
245
245
abs , _ := filepath .Abs (filepath .Join (store , file ))
246
246
return abs
247
247
})
248
- geth .expect (`
248
+ geth .Expect (`
249
249
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
250
250
!! Unsupported terminal, password will be echoed.
251
251
Passphrase: {{.InputLine "foobar"}}
@@ -257,14 +257,14 @@ Your passphrase unlocked keystore://{{keypath "1"}}
257
257
In order to avoid this warning, you need to remove the following duplicate key files:
258
258
keystore://{{keypath "2"}}
259
259
` )
260
- geth .expectExit ()
260
+ geth .ExpectExit ()
261
261
262
262
wantMessages := []string {
263
263
"Unlocked account" ,
264
264
"=0xf466859ead1932d743d622cb74fc058882e8648a" ,
265
265
}
266
266
for _ , m := range wantMessages {
267
- if ! strings .Contains (geth .stderrText (), m ) {
267
+ if ! strings .Contains (geth .StderrText (), m ) {
268
268
t .Errorf ("stderr text does not contain %q" , m )
269
269
}
270
270
}
@@ -275,14 +275,14 @@ func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) {
275
275
geth := runGeth (t ,
276
276
"--keystore" , store , "--nat" , "none" , "--nodiscover" , "--dev" ,
277
277
"--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
278
- defer geth .expectExit ()
278
+ defer geth .ExpectExit ()
279
279
280
280
// Helper for the expect template, returns absolute keystore path.
281
- geth .setTemplateFunc ("keypath" , func (file string ) string {
281
+ geth .SetTemplateFunc ("keypath" , func (file string ) string {
282
282
abs , _ := filepath .Abs (filepath .Join (store , file ))
283
283
return abs
284
284
})
285
- geth .expect (`
285
+ geth .Expect (`
286
286
Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
287
287
!! Unsupported terminal, password will be echoed.
288
288
Passphrase: {{.InputLine "wrong"}}
@@ -292,5 +292,5 @@ Multiple key files exist for address f466859ead1932d743d622cb74fc058882e8648a:
292
292
Testing your passphrase against all of them...
293
293
Fatal: None of the listed files could be unlocked.
294
294
` )
295
- geth .expectExit ()
295
+ geth .ExpectExit ()
296
296
}
0 commit comments