|
|
@@ -508,6 +508,7 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
Monero autosigning operations (compat mode)
|
|
|
"""
|
|
|
menu_prompt = 'efresh balances:\b'
|
|
|
+ listaddresses_menu_prompt = 'efresh bals:\b'
|
|
|
extra_daemons = ['ltc']
|
|
|
|
|
|
cmd_group = (
|
|
|
@@ -521,7 +522,7 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
('check_bal_alice2', 'mining, checking balance (wallet #2)'),
|
|
|
('fund_alice1', 'sending funds to Alice (wallet #1)'),
|
|
|
('mine_blocks_10', 'mining some blocks'),
|
|
|
- ('alice_listaddresses1', 'adding label to Alice’s tracking wallets (listaddresses)'),
|
|
|
+ ('alice_listaddresses_lbl', 'adding label to Alice’s tracking wallets (listaddresses)'),
|
|
|
('fund_alice1b', 'sending funds to Alice (wallet #1)'),
|
|
|
('mine_blocks_10', 'mining some blocks'),
|
|
|
('alice_twview1', 'adding label to Alice’s tracking wallets (twview)'),
|
|
|
@@ -536,7 +537,7 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
('fund_alice_sub3', 'sending funds to Alice’s subaddress #3 (wallet #2)'),
|
|
|
('alice_twview2', 'viewing Alice’s tracking wallets (reload, sort options)'),
|
|
|
('alice_twview3', 'viewing Alice’s tracking wallets (check balances)'),
|
|
|
- ('alice_listaddresses2', 'listing Alice’s addresses (sort options)'),
|
|
|
+ ('alice_listaddresses_sort', 'listing Alice’s addresses (sort options)'),
|
|
|
('wait_loop_start_compat', 'starting autosign wait loop in XMR compat mode [--coins=xmr]'),
|
|
|
('alice_txcreate1', 'creating a transaction'),
|
|
|
('alice_txabort1', 'aborting the transaction'),
|
|
|
@@ -548,6 +549,14 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
('wait_loop_start_ltc', 'starting autosign wait loop in XMR compat mode [--coins=ltc,xmr]'),
|
|
|
('alice_txsend1', 'sending the transaction'),
|
|
|
('wait_loop_kill', 'stopping autosign wait loop'),
|
|
|
+ ('alice_newacct1', 'adding account to Alice’s tracking wallet (dfl label)'),
|
|
|
+ ('alice_newacct2', 'adding account to Alice’s tracking wallet (no timestr)'),
|
|
|
+ ('alice_newacct3', 'adding account to Alice’s tracking wallet'),
|
|
|
+ ('alice_newacct4', 'adding account to Alice’s tracking wallet (dfl label, no timestr)'),
|
|
|
+ ('alice_newaddr1', 'adding address to Alice’s tracking wallet'),
|
|
|
+ ('alice_newaddr2', 'adding address to Alice’s tracking wallet (no timestr)'),
|
|
|
+ ('alice_newaddr3', 'adding address to Alice’s tracking wallet (dfl label)'),
|
|
|
+ ('alice_newaddr4', 'adding address to Alice’s tracking wallet (dfl label, no timestr)'),
|
|
|
('stop_daemons', 'stopping all wallet and coin daemons'),
|
|
|
)
|
|
|
|
|
|
@@ -600,12 +609,59 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
addr_data = data['MoneroMMGenWalletDumpFile']['data']['wallet_metadata'][1]['addresses']
|
|
|
return await self.fund_alice(addr=addr_data[addr_num-1]['address'], amt=amt)
|
|
|
|
|
|
- def alice_listaddresses1(self):
|
|
|
+ def alice_newacct1(self):
|
|
|
+ return self._alice_newacct(2, lbl_text='New Test Account', add_timestr=True)
|
|
|
+
|
|
|
+ def alice_newacct2(self):
|
|
|
+ return self._alice_newacct(1, lbl_text='New Test Account')
|
|
|
+
|
|
|
+ def alice_newacct3(self):
|
|
|
+ return self._alice_newacct(2, add_timestr=True)
|
|
|
+
|
|
|
+ def alice_newacct4(self):
|
|
|
+ return self._alice_newacct(2)
|
|
|
+
|
|
|
+ def _alice_newacct(self, wallet_num, lbl_text='', add_timestr=False):
|
|
|
+ return self._alice_twops(
|
|
|
+ 'listaddresses',
|
|
|
+ newacct_wallet_num = wallet_num,
|
|
|
+ lbl_text = lbl_text,
|
|
|
+ add_timestr = add_timestr,
|
|
|
+ expect_str = (lbl_text or 'new account ') + (r'.*\[20.*\]' if add_timestr else ''))
|
|
|
+
|
|
|
+ def alice_newaddr1(self):
|
|
|
+ return self._alice_newaddr(1, lbl_text='New Test Address', add_timestr=True)
|
|
|
+
|
|
|
+ def alice_newaddr2(self):
|
|
|
+ return self._alice_newaddr(1, lbl_text='New Test Address')
|
|
|
+
|
|
|
+ def alice_newaddr3(self):
|
|
|
+ return self._alice_newaddr(2, add_timestr=True)
|
|
|
+
|
|
|
+ def alice_newaddr4(self):
|
|
|
+ return self._alice_newaddr(2)
|
|
|
+
|
|
|
+ def _alice_newaddr(self, acct_num, lbl_text='', add_timestr=False):
|
|
|
return self._alice_twops(
|
|
|
'listaddresses',
|
|
|
- lbl_addr_num = 2,
|
|
|
- lbl_addr_idx_num = 0,
|
|
|
- lbl_add_timestr = True,
|
|
|
+ newaddr_acct_num = acct_num,
|
|
|
+ lbl_text = lbl_text,
|
|
|
+ add_timestr = add_timestr,
|
|
|
+ expect_str = (lbl_text or 'new address ') + (r'.*\[20.*\]' if add_timestr else ''))
|
|
|
+
|
|
|
+ def alice_listaddresses(self):
|
|
|
+ return self._alice_twops('listaddresses', menu='R')
|
|
|
+
|
|
|
+ def alice_listaddresses_sort(self):
|
|
|
+ return self._alice_twops('listaddresses', menu='aAdMELLuuuraAdMeEuu')
|
|
|
+
|
|
|
+ def alice_listaddresses_lbl(self):
|
|
|
+ return self._alice_twops(
|
|
|
+ 'listaddresses',
|
|
|
+ lbl_acct_num = 2,
|
|
|
+ lbl_addr_idx = 0,
|
|
|
+ lbl_text = 'New Test Label',
|
|
|
+ add_timestr = True,
|
|
|
menu = 'R',
|
|
|
expect_str = r'Primary account.*1\.234567891234')
|
|
|
|
|
|
@@ -615,10 +671,11 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
def alice_twview1(self):
|
|
|
return self._alice_twops(
|
|
|
'twview',
|
|
|
- lbl_addr_num = 1,
|
|
|
- lbl_addr_idx_num = 0,
|
|
|
+ lbl_acct_num = 1,
|
|
|
+ lbl_addr_idx = 0,
|
|
|
+ lbl_text = 'New Test Label',
|
|
|
menu = 'R',
|
|
|
- expect_str = r'New Label.*2\.469135782468')
|
|
|
+ expect_str = r'New Test Label.*2\.469135782468')
|
|
|
|
|
|
def alice_twview2(self):
|
|
|
return self._alice_twops('twview', menu='RaAdMraAdMe')
|
|
|
@@ -626,26 +683,27 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
def alice_twview3(self):
|
|
|
return self._alice_twops(
|
|
|
'twview',
|
|
|
+ interactive = False,
|
|
|
expect_arr = [
|
|
|
'Total XMR: 3.722345649021 [3.729999970119]',
|
|
|
'1 0.026296296417',
|
|
|
'0.007654321098'])
|
|
|
|
|
|
- def alice_listaddresses2(self):
|
|
|
- return self._alice_twops('listaddresses', menu='aAdMELLuuuraAdMeEuu')
|
|
|
-
|
|
|
def _alice_twops(
|
|
|
self,
|
|
|
op,
|
|
|
*,
|
|
|
- lbl_addr_num = None,
|
|
|
- lbl_addr_idx_num = None,
|
|
|
- lbl_add_timestr = False,
|
|
|
+ lbl_acct_num = None,
|
|
|
+ lbl_addr_idx = None,
|
|
|
+ newacct_wallet_num = None,
|
|
|
+ newaddr_acct_num = None,
|
|
|
+ lbl_text = '',
|
|
|
+ add_timestr = False,
|
|
|
menu = '',
|
|
|
+ interactive = True,
|
|
|
expect_str = '',
|
|
|
expect_arr = []):
|
|
|
|
|
|
- interactive = not expect_arr
|
|
|
self.insert_device_online()
|
|
|
t = self.spawn(
|
|
|
'mmgen-tool',
|
|
|
@@ -653,23 +711,35 @@ class CmdTestXMRCompat(CmdTestXMRAutosign):
|
|
|
+ self.autosign_opts
|
|
|
+ [op]
|
|
|
+ (['interactive=1'] if interactive else []))
|
|
|
+ menu_prompt = self.listaddresses_menu_prompt if op == 'listaddresses' else self.menu_prompt
|
|
|
+ have_lbl = lbl_acct_num or newacct_wallet_num or newaddr_acct_num
|
|
|
+ have_new_addr = newacct_wallet_num or newaddr_acct_num
|
|
|
if interactive:
|
|
|
- if lbl_addr_num:
|
|
|
- t.expect(self.menu_prompt, 'l')
|
|
|
- t.expect('main menu): ', str(lbl_addr_num))
|
|
|
- if lbl_addr_idx_num is not None:
|
|
|
- t.expect('main menu): ', str(lbl_addr_idx_num))
|
|
|
- t.expect(': ', 'New Label\n')
|
|
|
- t.expect('(y/N): ', 'y' if lbl_add_timestr else 'n')
|
|
|
+ if lbl_acct_num:
|
|
|
+ t.expect(menu_prompt, 'l')
|
|
|
+ t.expect('main menu): ', str(lbl_acct_num))
|
|
|
+ t.expect('main menu): ', str(lbl_addr_idx))
|
|
|
+ elif newacct_wallet_num:
|
|
|
+ t.expect(menu_prompt, 'N')
|
|
|
+ t.expect('number> ', f'{newacct_wallet_num}\n')
|
|
|
+ elif newaddr_acct_num:
|
|
|
+ t.expect(menu_prompt, 'n')
|
|
|
+ t.expect('main menu): ', str(newaddr_acct_num))
|
|
|
+ if have_lbl:
|
|
|
+ t.expect(': ', lbl_text + '\n') # add label
|
|
|
+ t.expect('(y/N): ', ('y' if add_timestr else 'n')) # add timestr
|
|
|
+ if have_new_addr:
|
|
|
+ t.expect('(y/N): ', 'y')
|
|
|
for ch in menu:
|
|
|
- t.expect(self.menu_prompt, ch)
|
|
|
+ t.expect(menu_prompt, ch)
|
|
|
if expect_str:
|
|
|
t.expect(expect_str, regex=True)
|
|
|
- t.expect(self.menu_prompt, 'q')
|
|
|
+ t.expect(menu_prompt, 'q')
|
|
|
elif expect_arr:
|
|
|
text = strip_ansi_escapes(t.read())
|
|
|
for s in expect_arr:
|
|
|
assert s in text
|
|
|
+ t.read()
|
|
|
self.remove_device_online()
|
|
|
return t
|
|
|
|