autosign: whitespace, test code cleanups
This commit is contained in:
parent
fbf6f0016d
commit
d5078e8ce6
2 changed files with 47 additions and 47 deletions
|
|
@ -40,21 +40,23 @@ opts_data = {
|
|||
'desc': 'Auto-sign MMGen transactions',
|
||||
'usage':'[opts] [command]',
|
||||
'options': """
|
||||
-h, --help Print this help message
|
||||
--, --longhelp Print help message for long options (common options)
|
||||
-c, --coins=c Coins to sign for (comma-separated list)
|
||||
-I, --no-insert-check Don't check for device insertion
|
||||
-l, --led Use status LED to signal standby, busy and error
|
||||
-m, --mountpoint=m Specify an alternate mountpoint (default: '{mp}')
|
||||
-n, --no-summary Don't print a transaction summary
|
||||
-s, --stealth-led Stealth LED mode - signal busy and error only, and only
|
||||
after successful authorization.
|
||||
-S, --full-summary Print a full summary of each signed transaction after
|
||||
each autosign run. The default list of non-MMGen outputs
|
||||
will not be printed.
|
||||
-q, --quiet Produce quieter output
|
||||
-v, --verbose Produce more verbose output
|
||||
""".format(mp=mountpoint),
|
||||
-h, --help Print this help message
|
||||
--, --longhelp Print help message for long options (common options)
|
||||
-c, --coins=c Coins to sign for (comma-separated list)
|
||||
-I, --no-insert-check Don’t check for device insertion
|
||||
-l, --led Use status LED to signal standby, busy and error
|
||||
-m, --mountpoint=M Specify an alternate mountpoint 'M' (default: '{mp}')
|
||||
-n, --no-summary Don’t print a transaction summary
|
||||
-s, --stealth-led Stealth LED mode - signal busy and error only, and only
|
||||
after successful authorization.
|
||||
-S, --full-summary Print a full summary of each signed transaction after
|
||||
each autosign run. The default list of non-MMGen outputs
|
||||
will not be printed.
|
||||
-q, --quiet Produce quieter output
|
||||
-v, --verbose Produce more verbose output
|
||||
""".format(
|
||||
mp = mountpoint
|
||||
),
|
||||
'notes': """
|
||||
|
||||
COMMANDS
|
||||
|
|
|
|||
|
|
@ -67,12 +67,21 @@ class TestSuiteAutosign(TestSuiteBase):
|
|||
if self.skip_for_win():
|
||||
return 'skip'
|
||||
|
||||
def make_wallet(opts):
|
||||
t = self.spawn('mmgen-autosign',opts+['gen_key'],extra_desc='(gen_key)')
|
||||
t.expect_getend('Wrote key file ')
|
||||
t.ok()
|
||||
def gen_key(opts):
|
||||
if not getattr(self,'key_generated',False):
|
||||
t = self.spawn('mmgen-autosign',opts+['gen_key'],extra_desc='(gen_key)')
|
||||
t.expect_getend('Wrote key file ')
|
||||
t.ok()
|
||||
self.key_generated = True
|
||||
|
||||
def make_wallet(opts):
|
||||
|
||||
t = self.spawn(
|
||||
'mmgen-autosign',
|
||||
opts +
|
||||
['setup'],
|
||||
extra_desc = '(setup)' )
|
||||
|
||||
t = self.spawn('mmgen-autosign',opts+['setup'],extra_desc='(setup)')
|
||||
t.expect('words: ','3')
|
||||
t.expect('OK? (Y/n): ','\n')
|
||||
mn_file = dfl_words_file
|
||||
|
|
@ -135,6 +144,7 @@ class TestSuiteAutosign(TestSuiteBase):
|
|||
|
||||
if gen_wallet:
|
||||
if not opt.skip_deps:
|
||||
gen_key(opts)
|
||||
make_wallet(opts)
|
||||
else:
|
||||
do_mount()
|
||||
|
|
@ -178,50 +188,38 @@ class TestSuiteAutosign(TestSuiteBase):
|
|||
|
||||
def do_autosign(opts,mountpoint):
|
||||
|
||||
def autosign_expect(t,txcount):
|
||||
t.expect('{} transactions signed'.format(txcount))
|
||||
t.expect('2 transactions failed to sign')
|
||||
t.expect('Waiting')
|
||||
t.kill(2)
|
||||
t.req_exit_val = 1
|
||||
imsg('')
|
||||
t.ok()
|
||||
|
||||
if not opt.skip_deps:
|
||||
gen_key(opts)
|
||||
make_wallet(opts)
|
||||
|
||||
copy_files(mountpoint,include_bad_tx=True)
|
||||
|
||||
t = self.spawn('mmgen-autosign',opts+['--full-summary','wait'],extra_desc='(sign - full summary)')
|
||||
t.expect('{} transactions signed'.format(txcount))
|
||||
t.expect('2 transactions failed to sign')
|
||||
t.expect('Waiting')
|
||||
t.kill(2)
|
||||
t.req_exit_val = 1
|
||||
imsg('')
|
||||
t.ok()
|
||||
t = self.spawn('mmgen-autosign',opts+['--quiet','wait'],extra_desc='(sign)')
|
||||
autosign_expect(t,txcount)
|
||||
|
||||
copy_files(mountpoint,remove_signed_only=True)
|
||||
t = self.spawn('mmgen-autosign',opts+['--quiet','wait'],extra_desc='(sign)')
|
||||
t.expect('{} transactions signed'.format(txcount))
|
||||
t.expect('2 transactions failed to sign')
|
||||
t.expect('Waiting')
|
||||
t.kill(2)
|
||||
t.req_exit_val = 1
|
||||
imsg('')
|
||||
t.ok()
|
||||
t = self.spawn('mmgen-autosign',opts+['--full-summary','wait'],extra_desc='(sign - full summary)')
|
||||
autosign_expect(t,txcount)
|
||||
|
||||
copy_files(mountpoint,include_bad_tx=True,fdata_in=(('btc',''),))
|
||||
t = self.spawn(
|
||||
'mmgen-autosign',
|
||||
opts + ['--quiet','--stealth-led','wait'],
|
||||
extra_desc='(sign - --quiet --stealth-led)' )
|
||||
t.expect('2 transactions failed to sign')
|
||||
t.expect('Waiting')
|
||||
t.kill(2)
|
||||
t.req_exit_val = 1
|
||||
imsg('')
|
||||
t.ok()
|
||||
autosign_expect(t,txcount)
|
||||
|
||||
copy_files(mountpoint,include_bad_tx=False,fdata_in=(('btc',''),))
|
||||
t = self.spawn(
|
||||
'mmgen-autosign',
|
||||
opts + ['--quiet','--led'],
|
||||
extra_desc='(sign - --quiet --led)' )
|
||||
t = self.spawn('mmgen-autosign',opts+['--quiet','--led'],extra_desc='(sign - --quiet --led)')
|
||||
t.read()
|
||||
imsg('')
|
||||
t.ok()
|
||||
|
||||
return t
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue