Skip to content

Commit 7675182

Browse files
committed
tests: test_wizard: dedupe wallet_name
1 parent a4c8cf2 commit 7675182

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

tests/test_wizard.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,12 @@ class WalletWizardTestCase(WizardTestCase):
130130
# TODO multisig
131131
# TODO slip39
132132

133-
def wizard_for(self, *, name: str, wallet_type: str) -> NewWalletWizard:
133+
def _wizard_for(
134+
self,
135+
*,
136+
name: str = "mywallet",
137+
wallet_type: str,
138+
) -> NewWalletWizard:
134139
w = NewWalletWizard(DaemonMock(self.config), self.plugins)
135140
if wallet_type == '2fa':
136141
w.plugins.get_plugin('trustedcoin').extend_wizard(w)
@@ -173,7 +178,7 @@ def _set_password_and_check_address(
173178
return wallet
174179

175180
async def test_set_password_and_encrypt_file(self):
176-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
181+
w = self._wizard_for(wallet_type='standard')
177182
v = w._current
178183
d = v.wizard_data
179184
self.assertEqual('keystore_type', v.view)
@@ -195,7 +200,7 @@ async def test_set_password_and_encrypt_file(self):
195200
self.assertTrue(wallet.has_storage_encryption())
196201

197202
async def test_set_password_but_dont_encrypt_file(self):
198-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
203+
w = self._wizard_for(wallet_type='standard')
199204
v = w._current
200205
d = v.wizard_data
201206
self.assertEqual('keystore_type', v.view)
@@ -217,7 +222,7 @@ async def test_set_password_but_dont_encrypt_file(self):
217222
self.assertFalse(wallet.has_storage_encryption())
218223

219224
async def test_create_standard_wallet_createseed(self):
220-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
225+
w = self._wizard_for(wallet_type='standard')
221226
v = w._current
222227
d = v.wizard_data
223228
self.assertEqual('keystore_type', v.view)
@@ -236,7 +241,7 @@ async def test_create_standard_wallet_createseed(self):
236241
self._set_password_and_check_address(v=v, w=w, recv_addr="bc1qq2tmmcngng78nllq2pvrkchcdukemtj56uyue0")
237242

238243
async def test_create_standard_wallet_createseed_passphrase(self):
239-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
244+
w = self._wizard_for(wallet_type='standard')
240245
v = w._current
241246
d = v.wizard_data
242247
self.assertEqual('keystore_type', v.view)
@@ -262,7 +267,7 @@ async def test_create_standard_wallet_createseed_passphrase(self):
262267
self._set_password_and_check_address(v=v, w=w, recv_addr="bc1qgvx24uzdv4mapfmtlu8azty5fxdcw9ghxu4pr4")
263268

264269
async def test_create_standard_wallet_haveseed_electrum_oldseed(self):
265-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
270+
w = self._wizard_for(wallet_type='standard')
266271
v = w._current
267272
d = v.wizard_data
268273
self.assertEqual('keystore_type', v.view)
@@ -278,7 +283,7 @@ async def test_create_standard_wallet_haveseed_electrum_oldseed(self):
278283
self._set_password_and_check_address(v=v, w=w, recv_addr="1FJEEB8ihPMbzs2SkLmr37dHyRFzakqUmo")
279284

280285
async def test_create_standard_wallet_haveseed_electrum_oldseed_passphrase(self):
281-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
286+
w = self._wizard_for(wallet_type='standard')
282287
v = w._current
283288
d = v.wizard_data
284289
self.assertEqual('keystore_type', v.view)
@@ -302,7 +307,7 @@ async def test_create_standard_wallet_haveseed_electrum_oldseed_passphrase(self)
302307
self.assertTrue("cannot have passphrase" in ctx.exception.args[0])
303308

304309
async def test_create_standard_wallet_haveseed_electrum(self):
305-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
310+
w = self._wizard_for(wallet_type='standard')
306311
v = w._current
307312
d = v.wizard_data
308313
self.assertEqual('keystore_type', v.view)
@@ -316,7 +321,7 @@ async def test_create_standard_wallet_haveseed_electrum(self):
316321
self._set_password_and_check_address(v=v, w=w, recv_addr="bc1qq2tmmcngng78nllq2pvrkchcdukemtj56uyue0")
317322

318323
async def test_create_standard_wallet_haveseed_electrum_passphrase(self):
319-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
324+
w = self._wizard_for(wallet_type='standard')
320325
v = w._current
321326
d = v.wizard_data
322327
self.assertEqual('keystore_type', v.view)
@@ -334,7 +339,7 @@ async def test_create_standard_wallet_haveseed_electrum_passphrase(self):
334339
self._set_password_and_check_address(v=v, w=w, recv_addr="bc1qgvx24uzdv4mapfmtlu8azty5fxdcw9ghxu4pr4")
335340

336341
async def test_create_standard_wallet_haveseed_bip39(self):
337-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
342+
w = self._wizard_for(wallet_type='standard')
338343
v = w._current
339344
d = v.wizard_data
340345
self.assertEqual('keystore_type', v.view)
@@ -352,7 +357,7 @@ async def test_create_standard_wallet_haveseed_bip39(self):
352357
self._set_password_and_check_address(v=v, w=w, recv_addr="bc1qrjr8qn4669jgr3s34f2pyj9awhz02eyvk5eh8g")
353358

354359
async def test_create_standard_wallet_haveseed_bip39_passphrase(self):
355-
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
360+
w = self._wizard_for(wallet_type='standard')
356361
v = w._current
357362
d = v.wizard_data
358363
self.assertEqual('keystore_type', v.view)
@@ -375,7 +380,7 @@ async def test_create_standard_wallet_haveseed_bip39_passphrase(self):
375380

376381
async def test_2fa_createseed(self):
377382
self.assertTrue(self.config.get('enable_plugin_trustedcoin'))
378-
w = self.wizard_for(name='test_2fa_wallet', wallet_type='2fa')
383+
w = self._wizard_for(wallet_type='2fa')
379384
v = w._current
380385
d = v.wizard_data
381386
self.assertEqual('trustedcoin_start', v.view)
@@ -399,7 +404,7 @@ async def test_2fa_createseed(self):
399404

400405
async def test_2fa_haveseed_keep2FAenabled(self):
401406
self.assertTrue(self.config.get('enable_plugin_trustedcoin'))
402-
w = self.wizard_for(name='test_2fa_wallet', wallet_type='2fa')
407+
w = self._wizard_for(wallet_type='2fa')
403408
v = w._current
404409
d = v.wizard_data
405410
self.assertEqual('trustedcoin_start', v.view)
@@ -425,7 +430,7 @@ async def test_2fa_haveseed_keep2FAenabled(self):
425430

426431
async def test_2fa_haveseed_disable2FA(self):
427432
self.assertTrue(self.config.get('enable_plugin_trustedcoin'))
428-
w = self.wizard_for(name='test_2fa_wallet', wallet_type='2fa')
433+
w = self._wizard_for(wallet_type='2fa')
429434
v = w._current
430435
d = v.wizard_data
431436
self.assertEqual('trustedcoin_start', v.view)
@@ -447,7 +452,7 @@ async def test_2fa_haveseed_disable2FA(self):
447452

448453
async def test_2fa_haveseed_passphrase(self):
449454
self.assertTrue(self.config.get('enable_plugin_trustedcoin'))
450-
w = self.wizard_for(name='test_2fa_wallet', wallet_type='2fa')
455+
w = self._wizard_for(wallet_type='2fa')
451456
v = w._current
452457
d = v.wizard_data
453458
self.assertEqual('trustedcoin_start', v.view)

0 commit comments

Comments
 (0)