@@ -44,21 +44,21 @@ func tmpDatadirWithKeystore(t *testing.T) string {
4444
4545func TestAccountListEmpty (t * testing.T ) {
4646 geth := runGeth (t , "account" , "list" )
47- geth .expectExit ()
47+ geth .ExpectExit ()
4848}
4949
5050func TestAccountList (t * testing.T ) {
5151 datadir := tmpDatadirWithKeystore (t )
5252 geth := runGeth (t , "account" , "list" , "--datadir" , datadir )
53- defer geth .expectExit ()
53+ defer geth .ExpectExit ()
5454 if runtime .GOOS == "windows" {
55- geth .expect (`
55+ geth .Expect (`
5656Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
5757Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}\keystore\aaa
5858Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}\keystore\zzz
5959` )
6060 } else {
61- geth .expect (`
61+ geth .Expect (`
6262Account #0: {7ef5a6135f1fd6a02593eedc869c6d41d934aef8} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
6363Account #1: {f466859ead1932d743d622cb74fc058882e8648a} keystore://{{.Datadir}}/keystore/aaa
6464Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/keystore/zzz
@@ -68,20 +68,20 @@ Account #2: {289d485d9771714cce91d3393d764e1311907acc} keystore://{{.Datadir}}/k
6868
6969func TestAccountNew (t * testing.T ) {
7070 geth := runGeth (t , "account" , "new" , "--lightkdf" )
71- defer geth .expectExit ()
72- geth .expect (`
71+ defer geth .ExpectExit ()
72+ geth .Expect (`
7373Your new account is locked with a password. Please give a password. Do not forget this password.
7474!! Unsupported terminal, password will be echoed.
7575Passphrase: {{.InputLine "foobar"}}
7676Repeat passphrase: {{.InputLine "foobar"}}
7777` )
78- geth .expectRegexp (`Address: \{[0-9a-f]{40}\}\n` )
78+ geth .ExpectRegexp (`Address: \{[0-9a-f]{40}\}\n` )
7979}
8080
8181func TestAccountNewBadRepeat (t * testing.T ) {
8282 geth := runGeth (t , "account" , "new" , "--lightkdf" )
83- defer geth .expectExit ()
84- geth .expect (`
83+ defer geth .ExpectExit ()
84+ geth .Expect (`
8585Your new account is locked with a password. Please give a password. Do not forget this password.
8686!! Unsupported terminal, password will be echoed.
8787Passphrase: {{.InputLine "something"}}
@@ -95,8 +95,8 @@ func TestAccountUpdate(t *testing.T) {
9595 geth := runGeth (t , "account" , "update" ,
9696 "--datadir" , datadir , "--lightkdf" ,
9797 "f466859ead1932d743d622cb74fc058882e8648a" )
98- defer geth .expectExit ()
99- geth .expect (`
98+ defer geth .ExpectExit ()
99+ geth .Expect (`
100100Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
101101!! Unsupported terminal, password will be echoed.
102102Passphrase: {{.InputLine "foobar"}}
@@ -108,8 +108,8 @@ Repeat passphrase: {{.InputLine "foobar2"}}
108108
109109func TestWalletImport (t * testing.T ) {
110110 geth := runGeth (t , "wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
111- defer geth .expectExit ()
112- geth .expect (`
111+ defer geth .ExpectExit ()
112+ geth .Expect (`
113113!! Unsupported terminal, password will be echoed.
114114Passphrase: {{.InputLine "foo"}}
115115Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
@@ -123,8 +123,8 @@ Address: {d4584b5f6229b7be90727b0fc8c6b91bb427821f}
123123
124124func TestWalletImportBadPassword (t * testing.T ) {
125125 geth := runGeth (t , "wallet" , "import" , "--lightkdf" , "testdata/guswallet.json" )
126- defer geth .expectExit ()
127- geth .expect (`
126+ defer geth .ExpectExit ()
127+ geth .Expect (`
128128!! Unsupported terminal, password will be echoed.
129129Passphrase: {{.InputLine "wrong"}}
130130Fatal: could not decrypt key with given passphrase
@@ -137,19 +137,19 @@ func TestUnlockFlag(t *testing.T) {
137137 "--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
138138 "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
139139 "js" , "testdata/empty.js" )
140- geth .expect (`
140+ geth .Expect (`
141141Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
142142!! Unsupported terminal, password will be echoed.
143143Passphrase: {{.InputLine "foobar"}}
144144` )
145- geth .expectExit ()
145+ geth .ExpectExit ()
146146
147147 wantMessages := []string {
148148 "Unlocked account" ,
149149 "=0xf466859ead1932d743d622cb74fc058882e8648a" ,
150150 }
151151 for _ , m := range wantMessages {
152- if ! strings .Contains (geth .stderrText (), m ) {
152+ if ! strings .Contains (geth .StderrText (), m ) {
153153 t .Errorf ("stderr text does not contain %q" , m )
154154 }
155155 }
@@ -160,8 +160,8 @@ func TestUnlockFlagWrongPassword(t *testing.T) {
160160 geth := runGeth (t ,
161161 "--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
162162 "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
163- defer geth .expectExit ()
164- geth .expect (`
163+ defer geth .ExpectExit ()
164+ geth .Expect (`
165165Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
166166!! Unsupported terminal, password will be echoed.
167167Passphrase: {{.InputLine "wrong1"}}
@@ -180,22 +180,22 @@ func TestUnlockFlagMultiIndex(t *testing.T) {
180180 "--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
181181 "--unlock" , "0,2" ,
182182 "js" , "testdata/empty.js" )
183- geth .expect (`
183+ geth .Expect (`
184184Unlocking account 0 | Attempt 1/3
185185!! Unsupported terminal, password will be echoed.
186186Passphrase: {{.InputLine "foobar"}}
187187Unlocking account 2 | Attempt 1/3
188188Passphrase: {{.InputLine "foobar"}}
189189` )
190- geth .expectExit ()
190+ geth .ExpectExit ()
191191
192192 wantMessages := []string {
193193 "Unlocked account" ,
194194 "=0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8" ,
195195 "=0x289d485d9771714cce91d3393d764e1311907acc" ,
196196 }
197197 for _ , m := range wantMessages {
198- if ! strings .Contains (geth .stderrText (), m ) {
198+ if ! strings .Contains (geth .StderrText (), m ) {
199199 t .Errorf ("stderr text does not contain %q" , m )
200200 }
201201 }
@@ -207,15 +207,15 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
207207 "--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
208208 "--password" , "testdata/passwords.txt" , "--unlock" , "0,2" ,
209209 "js" , "testdata/empty.js" )
210- geth .expectExit ()
210+ geth .ExpectExit ()
211211
212212 wantMessages := []string {
213213 "Unlocked account" ,
214214 "=0x7ef5a6135f1fd6a02593eedc869c6d41d934aef8" ,
215215 "=0x289d485d9771714cce91d3393d764e1311907acc" ,
216216 }
217217 for _ , m := range wantMessages {
218- if ! strings .Contains (geth .stderrText (), m ) {
218+ if ! strings .Contains (geth .StderrText (), m ) {
219219 t .Errorf ("stderr text does not contain %q" , m )
220220 }
221221 }
@@ -226,8 +226,8 @@ func TestUnlockFlagPasswordFileWrongPassword(t *testing.T) {
226226 geth := runGeth (t ,
227227 "--datadir" , datadir , "--nat" , "none" , "--nodiscover" , "--dev" ,
228228 "--password" , "testdata/wrong-passwords.txt" , "--unlock" , "0,2" )
229- defer geth .expectExit ()
230- geth .expect (`
229+ defer geth .ExpectExit ()
230+ geth .Expect (`
231231Fatal: Failed to unlock account 0 (could not decrypt key with given passphrase)
232232` )
233233}
@@ -238,14 +238,14 @@ func TestUnlockFlagAmbiguous(t *testing.T) {
238238 "--keystore" , store , "--nat" , "none" , "--nodiscover" , "--dev" ,
239239 "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" ,
240240 "js" , "testdata/empty.js" )
241- defer geth .expectExit ()
241+ defer geth .ExpectExit ()
242242
243243 // 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 {
245245 abs , _ := filepath .Abs (filepath .Join (store , file ))
246246 return abs
247247 })
248- geth .expect (`
248+ geth .Expect (`
249249Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
250250!! Unsupported terminal, password will be echoed.
251251Passphrase: {{.InputLine "foobar"}}
@@ -257,14 +257,14 @@ Your passphrase unlocked keystore://{{keypath "1"}}
257257In order to avoid this warning, you need to remove the following duplicate key files:
258258 keystore://{{keypath "2"}}
259259` )
260- geth .expectExit ()
260+ geth .ExpectExit ()
261261
262262 wantMessages := []string {
263263 "Unlocked account" ,
264264 "=0xf466859ead1932d743d622cb74fc058882e8648a" ,
265265 }
266266 for _ , m := range wantMessages {
267- if ! strings .Contains (geth .stderrText (), m ) {
267+ if ! strings .Contains (geth .StderrText (), m ) {
268268 t .Errorf ("stderr text does not contain %q" , m )
269269 }
270270 }
@@ -275,14 +275,14 @@ func TestUnlockFlagAmbiguousWrongPassword(t *testing.T) {
275275 geth := runGeth (t ,
276276 "--keystore" , store , "--nat" , "none" , "--nodiscover" , "--dev" ,
277277 "--unlock" , "f466859ead1932d743d622cb74fc058882e8648a" )
278- defer geth .expectExit ()
278+ defer geth .ExpectExit ()
279279
280280 // 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 {
282282 abs , _ := filepath .Abs (filepath .Join (store , file ))
283283 return abs
284284 })
285- geth .expect (`
285+ geth .Expect (`
286286Unlocking account f466859ead1932d743d622cb74fc058882e8648a | Attempt 1/3
287287!! Unsupported terminal, password will be echoed.
288288Passphrase: {{.InputLine "wrong"}}
@@ -292,5 +292,5 @@ Multiple key files exist for address f466859ead1932d743d622cb74fc058882e8648a:
292292Testing your passphrase against all of them...
293293Fatal: None of the listed files could be unlocked.
294294` )
295- geth .expectExit ()
295+ geth .ExpectExit ()
296296}
0 commit comments