minor fixes and cleanups
This commit is contained in:
parent
2305efc39d
commit
5545a011b0
4 changed files with 38 additions and 23 deletions
|
|
@ -17,7 +17,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
"""
|
||||
crypto.py: Cryptographic and related routines for the MMGen suite
|
||||
crypto.py: Random number, password hashing and symmetric encryption routines for the MMGen suite
|
||||
"""
|
||||
|
||||
import os
|
||||
|
|
|
|||
|
|
@ -356,12 +356,12 @@ create_tmpdir() {
|
|||
rm -rf /tmp/mmgen-test-release*
|
||||
create_tmpdir
|
||||
|
||||
i_xmr='Monero xmrwallet'
|
||||
s_xmr='Testing xmrwallet operations'
|
||||
i_xmr='Monero'
|
||||
s_xmr='Testing Monero operations'
|
||||
t_xmr="
|
||||
- $test_py --coin=xmr xmrwallet
|
||||
- $test_py --coin=xmr
|
||||
"
|
||||
f_xmr='Monero xmrwallet tests completed'
|
||||
f_xmr='Monero tests completed'
|
||||
|
||||
i_eth='Ethereum'
|
||||
s_eth='Testing transaction and tracking wallet operations for Ethereum'
|
||||
|
|
|
|||
|
|
@ -43,40 +43,55 @@ class TestSuiteMisc(TestSuiteBase):
|
|||
|
||||
class TestSuiteHelp(TestSuiteBase):
|
||||
'help, info and usage screens'
|
||||
networks = ('btc','ltc','bch','eth')
|
||||
networks = ('btc','ltc','bch','eth','xmr')
|
||||
tmpdir_nums = []
|
||||
passthru_opts = ('daemon_data_dir','rpc_port','coin','testnet')
|
||||
cmd_group = (
|
||||
('usage', (1,'usage message',[])),
|
||||
('helpscreens', (1,'help screens', [])),
|
||||
('longhelpscreens', (1,'help screens (--longhelp)',[])),
|
||||
('opt_show_hash_presets', (1,'info screen (--show-hash-presets)',[])),
|
||||
('show_hash_presets', (1,'info screen (--show-hash-presets)',[])),
|
||||
('tool_help', (1,"'mmgen-tool' usage screen",[])),
|
||||
('test_help', (1,"'test.py' help screens",[])),
|
||||
)
|
||||
def helpscreens(self,
|
||||
arg = '--help',
|
||||
scripts = ( 'walletgen','walletconv','walletchk','passchg','subwalletgen',
|
||||
'addrgen','keygen','passgen',
|
||||
'seedsplit','seedjoin',
|
||||
'txcreate','txsign','txsend','txdo','txbump',
|
||||
'addrimport','autosign')
|
||||
):
|
||||
if self.test_name == 'helpscreens' and self.proto.base_coin != 'ETH':
|
||||
scripts += ('regtest','xmrwallet')
|
||||
|
||||
def usage(self):
|
||||
t = self.spawn(f'mmgen-walletgen',['foo'])
|
||||
t.expect('USAGE: mmgen-walletgen')
|
||||
t.req_exit_val = 1
|
||||
return t
|
||||
|
||||
def helpscreens(self,arg='--help',scripts=(),expect='USAGE:.*OPTIONS:'):
|
||||
|
||||
scripts = scripts or tuple(s.replace('mmgen-','') for s in os.listdir('cmds'))
|
||||
|
||||
if self.test_name.endswith('helpscreens'):
|
||||
skip = (
|
||||
['regtest','xmrwallet'] if self.proto.base_coin == 'ETH' else
|
||||
['regtest'] if self.proto.base_coin == 'XMR' else
|
||||
[] )
|
||||
scripts = sorted( set(scripts) - set(skip) )
|
||||
|
||||
for s in scripts:
|
||||
t = self.spawn_chk(f'mmgen-{s}',[arg],extra_desc=f'(mmgen-{s})',no_output=True)
|
||||
t = self.spawn(f'mmgen-{s}',[arg],extra_desc=f'(mmgen-{s})')
|
||||
t.expect(expect,regex=True)
|
||||
t.read()
|
||||
t.ok()
|
||||
t.skip_ok = True
|
||||
|
||||
return t
|
||||
|
||||
def longhelpscreens(self):
|
||||
return self.helpscreens(arg='--longhelp')
|
||||
return self.helpscreens(arg='--longhelp',expect='USAGE:.*LONG OPTIONS:')
|
||||
|
||||
def opt_show_hash_presets(self):
|
||||
def show_hash_presets(self):
|
||||
return self.helpscreens(
|
||||
arg = '--show-hash-presets',
|
||||
scripts = (
|
||||
'walletgen','walletconv','walletchk','passchg','subwalletgen',
|
||||
'addrgen','keygen','passgen',
|
||||
'txsign','txdo','txbump'))
|
||||
'txsign','txdo','txbump'),
|
||||
expect = 'Available parameters.*Preset' )
|
||||
|
||||
def tool_help(self):
|
||||
|
||||
|
|
@ -85,8 +100,6 @@ class TestSuiteHelp(TestSuiteBase):
|
|||
return 'skip'
|
||||
|
||||
for args in (
|
||||
['--help'],
|
||||
['--longhelp'],
|
||||
['help'],
|
||||
['usage'],
|
||||
['help','randpair']
|
||||
|
|
|
|||
|
|
@ -261,6 +261,8 @@ class TestSuiteRegtest(TestSuiteBase,TestSuiteShared):
|
|||
|
||||
def __init__(self,trunner,cfgs,spawn):
|
||||
TestSuiteBase.__init__(self,trunner,cfgs,spawn)
|
||||
if trunner == None:
|
||||
return
|
||||
if self.proto.testnet:
|
||||
die(2,'--testnet and --regtest options incompatible with regtest test suite')
|
||||
self.proto = init_proto(self.proto.coin,network='regtest')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue