Skip to content

Commit e56bc4f

Browse files
committed
tests: test_wizard: add final check: try loading created wallet file
1 parent 01a1eac commit e56bc4f

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/test_wizard.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
from electrum.network import NetworkParameters, ProxySettings
66
from electrum.plugin import Plugins
77
from electrum.wizard import ServerConnectWizard, NewWalletWizard
8-
from tests import ElectrumTestCase
8+
from electrum.daemon import Daemon
9+
10+
from . import ElectrumTestCase
911

1012

1113
class NetworkMock:
@@ -27,7 +29,7 @@ def get_parameters(self):
2729

2830

2931
class DaemonMock:
30-
def __init__(self, config):
32+
def __init__(self, config: SimpleConfig):
3133
self.config = config
3234
self.network = NetworkMock()
3335

@@ -159,6 +161,8 @@ async def test_create_standard_wallet_newseed(self):
159161
w.create_storage(wallet_path, d)
160162

161163
self.assertTrue(os.path.exists(wallet_path))
164+
wallet = Daemon._load_wallet(wallet_path, password=None, config=self.config)
165+
self.assertEqual("bc1qq2tmmcngng78nllq2pvrkchcdukemtj56uyue0", wallet.get_receiving_addresses()[0])
162166

163167
async def test_create_standard_wallet_haveseed_electrum(self):
164168
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
@@ -183,6 +187,8 @@ async def test_create_standard_wallet_haveseed_electrum(self):
183187
w.create_storage(wallet_path, d)
184188

185189
self.assertTrue(os.path.exists(wallet_path))
190+
wallet = Daemon._load_wallet(wallet_path, password=None, config=self.config)
191+
self.assertEqual("bc1qq2tmmcngng78nllq2pvrkchcdukemtj56uyue0", wallet.get_receiving_addresses()[0])
186192

187193
async def test_create_standard_wallet_haveseed_bip39(self):
188194
w = self.wizard_for(name='test_standard_wallet', wallet_type='standard')
@@ -199,7 +205,7 @@ async def test_create_standard_wallet_haveseed_bip39(self):
199205
v = w.resolve_next(v.view, d)
200206
self.assertEqual('script_and_derivation', v.view)
201207

202-
d.update({'script_type': 'p2wsh', 'derivation_path': 'm'})
208+
d.update({'script_type': 'p2wpkh', 'derivation_path': 'm'})
203209
v = w.resolve_next(v.view, d)
204210
self.assertEqual('wallet_password', v.view)
205211

@@ -211,6 +217,8 @@ async def test_create_standard_wallet_haveseed_bip39(self):
211217
w.create_storage(wallet_path, d)
212218

213219
self.assertTrue(os.path.exists(wallet_path))
220+
wallet = Daemon._load_wallet(wallet_path, password=None, config=self.config)
221+
self.assertEqual("bc1qrjr8qn4669jgr3s34f2pyj9awhz02eyvk5eh8g", wallet.get_receiving_addresses()[0])
214222

215223
async def test_2fa(self):
216224
self.assertTrue(self.config.get('enable_plugin_trustedcoin'))
@@ -247,3 +255,5 @@ async def test_2fa(self):
247255
w.create_storage(wallet_path, d)
248256

249257
self.assertTrue(os.path.exists(wallet_path))
258+
wallet = Daemon._load_wallet(wallet_path, password=None, config=self.config)
259+
self.assertEqual("bc1qnf5qafvpx0afk47433j3tt30pqkxp5wa263m77wt0pvyqq67rmfs522m94", wallet.get_receiving_addresses()[0])

0 commit comments

Comments
 (0)