test suite: minor changes
This commit is contained in:
parent
8a68f00ab7
commit
18ee26f851
4 changed files with 13 additions and 12 deletions
|
|
@ -25,6 +25,7 @@ class TestSuiteFatalException(Exception): pass
|
|||
|
||||
import os
|
||||
from mmgen.common import *
|
||||
from mmgen.devtools import *
|
||||
|
||||
ascii_uc = ''.join(map(chr,list(range(65,91)))) # 26 chars
|
||||
ascii_lc = ''.join(map(chr,list(range(97,123)))) # 26 chars
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import sys,os,time
|
|||
from mmgen.globalvars import g
|
||||
from mmgen.opts import opt
|
||||
from mmgen.util import msg,msg_r,vmsg,vmsg_r,rmsg,red,yellow,green,cyan,die,rdie
|
||||
from test.common import getrandstr
|
||||
from test.common import *
|
||||
|
||||
try:
|
||||
import pexpect
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ os.environ['MMGEN_TEST_SUITE'] = '1'
|
|||
|
||||
# Import this _after_ local path's been added to sys.path
|
||||
from mmgen.common import *
|
||||
from test.common import init_coverage
|
||||
from test.common import *
|
||||
|
||||
opts_data = {
|
||||
'text': {
|
||||
|
|
|
|||
|
|
@ -188,13 +188,15 @@ class TestSuiteShared(object):
|
|||
if sid: cmp_or_die(chk,sid)
|
||||
return t
|
||||
|
||||
def addrgen(self,wf,pf=None,check_ref=False,ftype='addr',id_str=None,extra_args=[],mmtype=None):
|
||||
if not mmtype and ftype[:4] != 'pass':
|
||||
def addrgen(self,wf,pf=None,check_ref=False,ftype='addr',id_str=None,extra_args=[],mmtype=None,stdout=False):
|
||||
passgen = ftype[:4] == 'pass'
|
||||
if not mmtype and not passgen:
|
||||
mmtype = self.segwit_mmtype
|
||||
cmd_pfx = (ftype,'pass')[ftype[:4]=='pass']
|
||||
cmd_pfx = (ftype,'pass')[passgen]
|
||||
t = self.spawn('mmgen-{}gen'.format(cmd_pfx),
|
||||
['-d',self.tmpdir] + extra_args +
|
||||
([],['--type='+str(mmtype)])[bool(mmtype)] +
|
||||
([],['--stdout'])[stdout] +
|
||||
([],[wf])[bool(wf)] +
|
||||
([],[id_str])[bool(id_str)] +
|
||||
[getattr(self,'{}_idx_list'.format(cmd_pfx))],
|
||||
|
|
@ -202,15 +204,13 @@ class TestSuiteShared(object):
|
|||
t.license()
|
||||
t.passphrase('MMGen wallet',self.wpasswd)
|
||||
t.expect('Passphrase is OK')
|
||||
desc = ('address','password')[ftype[:4]=='pass']
|
||||
desc = ('address','password')[passgen]
|
||||
chk = t.expect_getend(r'Checksum for {} data .*?: '.format(desc),regex=True)
|
||||
if ftype[:4] == 'pass':
|
||||
t.expect('Encrypt password list? (y/N): ','\n')
|
||||
t.written_to_file('Password list',oo=True)
|
||||
else:
|
||||
t.written_to_file('Addresses',oo=True)
|
||||
if passgen:
|
||||
t.expect('Encrypt password list? (y/N): ','N')
|
||||
t.read() if stdout else t.written_to_file(('Addresses','Password list')[passgen])
|
||||
if check_ref:
|
||||
chk_ref = (self.chk_data[self.test_name] if ftype[:4] == 'pass' else
|
||||
chk_ref = (self.chk_data[self.test_name] if passgen else
|
||||
self.chk_data[self.test_name][self.fork][g.testnet])
|
||||
cmp_or_die(chk,chk_ref,desc='{}list data checksum'.format(ftype))
|
||||
return t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue