cmdtest automount, automount_eth, ethdev: cleanups

This commit is contained in:
The MMGen Project 2024-03-03 09:59:02 +00:00
commit 4fca289556
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 11 additions and 13 deletions

View file

@ -24,6 +24,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
networks = ('btc', 'bch', 'ltc')
tmpdir_nums = [49]
extra_spawn_args = []
rtFundAmt = None # pylint
rt_data = {
@ -210,7 +211,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
if not no_wait:
self._wait_signed('transaction')
self.insert_device_online()
t = self.spawn('mmgen-txsend', ['--quiet', '--autosign'])
t = self.spawn('mmgen-txsend', ['--alice', '--quiet', '--autosign'])
t.view_tx('t')
t.do_comment(comment)
self._do_confirm_send(t, quiet=True)
@ -232,7 +233,7 @@ class CmdTestAutosignAutomount(CmdTestAutosignThreaded, CmdTestRegtest):
if cfg.coin == 'BCH':
return 'skip'
self.insert_device_online()
t = self.spawn('mmgen-txbump', ['--autosign'])
t = self.spawn('mmgen-txbump', ['--alice', '--autosign'])
if bad_tx_desc:
t.expect('Only sent transactions')
t.expect(bad_tx_desc)

View file

@ -59,16 +59,13 @@ class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev):
CmdTestAutosignThreaded.__init__(self, trunner, cfgs, spawn)
CmdTestEthdev.__init__(self, trunner, cfgs, spawn)
if trunner == None:
return
self.opts.append('--alice')
self.txcreate_args = ['--quiet']
def fund_mmgen_address(self):
keyfile = os.path.join(self.tmpdir, parity_devkey_fn)
t = self.spawn(
'mmgen-txdo',
['--quiet']
self.eth_args
+ [f'--keys-from-file={keyfile}']
+ ['--fee=40G', '98831F3A:E:1,123.456', dfl_words_file],
)

View file

@ -400,6 +400,7 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
if trunner is None:
return
self.txcreate_args = [f'--outdir={self.tmpdir}', '--quiet']
self.eth_args = [f'--outdir={self.tmpdir}', '--quiet']
self.eth_args_noquiet = [f'--outdir={self.tmpdir}']
@ -627,7 +628,7 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
no_read = False,
tweaks = []):
fee_info_pat = r'\D{}\D.*{c} .*\D{}\D.*gas price in Gwei'.format( *fee_info_data, c=self.proto.coin )
t = self.spawn('mmgen-'+caller, self.eth_args + ['-B'] + args)
t = self.spawn('mmgen-'+caller, self.txcreate_args + ['-B'] + args)
t.expect(r'add \[l\]abel, .*?:.','p', regex=True)
t.written_to_file('Account balances listing')
t = self.txcreate_ui_common(
@ -653,9 +654,8 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
txfile = self.get_file_with_ext(ext,no_dot=True)
t = self.spawn(
'mmgen-txsign',
[f'--outdir={self.tmpdir}']
self.eth_args
+ [f'--coin={self.proto.coin}']
+ ['--quiet']
+ ['--rpc-host=bad_host'] # ETH signing must work without RPC
+ add_args
+ ([],['--yes'])[ni]
@ -1149,7 +1149,7 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
def token_txcreate(self,args=[],token='',inputs='1',fee='50G',file_desc='Unsigned transaction'):
return self.txcreate_ui_common(
self.spawn('mmgen-txcreate', self.eth_args + ['--token='+token,'-B','--fee='+fee] + args),
self.spawn('mmgen-txcreate', self.txcreate_args + ['--token='+token,'-B','--fee='+fee] + args),
menu = [],
inputs = inputs,
input_sels_prompt = 'to spend from',
@ -1302,7 +1302,7 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
if self.proto.coin == 'ETC' and adj_total:
total = str(Decimal(total) + self.bal_corr)
t = self.spawn('mmgen-txcreate', self.eth_args + args)
t = self.spawn('mmgen-txcreate', self.txcreate_args + args)
for n in bals:
t.expect('[R]efresh balance:\b','R')
t.expect(' main menu): ',n+'\n')
@ -1365,7 +1365,7 @@ class CmdTestEthdev(CmdTestBase,CmdTestShared):
comment_text = None,
changed = False,
pexpect_spawn = None):
t = self.spawn('mmgen-txcreate', self.eth_args + args + ['-B','-i'],pexpect_spawn=pexpect_spawn)
t = self.spawn('mmgen-txcreate', self.txcreate_args + args + ['-B','-i'],pexpect_spawn=pexpect_spawn)
menu_prompt = 'efresh balance:\b'