cmdtest.py: new ref_tx test
This commit is contained in:
parent
e1d715ea76
commit
836dbdb5d9
6 changed files with 57 additions and 43 deletions
|
|
@ -792,9 +792,9 @@ class CmdTestAutosign(CmdTestAutosignBase):
|
|||
|
||||
assert op in ('copy', 'set_count', 'remove_signed')
|
||||
|
||||
from .ref import CmdTestRef
|
||||
from .ref import CmdTestRefTX
|
||||
def gen():
|
||||
d = CmdTestRef.sources['ref_tx_file']
|
||||
d = CmdTestRefTX.sources['ref_tx_file']
|
||||
dirmap = [e for e in self.filedir_map if e[0] in (txfile_coins or self.txfile_coins)]
|
||||
for coin, coindir in dirmap:
|
||||
for network in (0, 1):
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ cmd_groups_dfl = {
|
|||
'main': gd('CmdTestMain', {'full_data': True}),
|
||||
'conv': gd('CmdTestWalletConv', {'is3seed': True, 'modname': 'wallet'}),
|
||||
'ref': gd('CmdTestRef', {}),
|
||||
'ref_tx': gd('CmdTestRefTX', {'modname': 'ref'}),
|
||||
'ref3': gd('CmdTestRef3Seed', {'is3seed': True, 'modname': 'ref_3seed'}),
|
||||
'ref3_addr': gd('CmdTestRef3Addr', {'is3seed': True, 'modname': 'ref_3seed'}),
|
||||
'ref3_pw': gd('CmdTestRef3Passwd', {'is3seed': True, 'modname': 'ref_3seed'}),
|
||||
|
|
@ -62,7 +63,7 @@ cmd_groups_extra = {
|
|||
'autosign_btc': gd('CmdTestAutosignBTC', {'modname': 'autosign'}),
|
||||
'autosign_live': gd('CmdTestAutosignLive', {'modname': 'autosign'}),
|
||||
'autosign_live_simulate': gd('CmdTestAutosignLiveSimulate', {'modname': 'autosign'}),
|
||||
'create_ref_tx': gd('CmdTestRefTX', {'modname': 'misc', 'full_data': True}),
|
||||
'create_ref_tx': gd('CmdTestCreateRefTX', {'modname': 'misc', 'full_data': True}),
|
||||
'xmr_autosign_nocompat': gd('CmdTestXMRAutosignNoCompat', {'modname': 'xmr_autosign'}),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ class CmdTestOutput(CmdTestBase):
|
|||
return 'skip'
|
||||
return self.oneshot_warning(pexpect_spawn=True)
|
||||
|
||||
class CmdTestRefTX(CmdTestMain, CmdTestBase):
|
||||
class CmdTestCreateRefTX(CmdTestMain, CmdTestBase):
|
||||
'create a reference transaction file (administrative command)'
|
||||
segwit_opts_ok = False
|
||||
passthru_opts = ('daemon_data_dir', 'rpc_port', 'coin', 'testnet')
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ from .shared import CmdTestShared
|
|||
wpasswd = 'reference password'
|
||||
|
||||
class CmdTestRef(CmdTestBase, CmdTestShared):
|
||||
'saved reference address, password and transaction files'
|
||||
'saved reference address, password and non-standard wallet files'
|
||||
tmpdir_nums = [8]
|
||||
networks = ('btc', 'btc_tn', 'ltc', 'ltc_tn')
|
||||
passthru_opts = ('daemon_data_dir', 'rpc_port', 'coin', 'testnet')
|
||||
|
|
@ -67,32 +67,6 @@ class CmdTestRef(CmdTestBase, CmdTestShared):
|
|||
'ref_passwdfile_bip39_24': '98831F3A-фубар@crypto.org-bip39-24[1,4,1100].pws',
|
||||
'ref_passwdfile_xmrseed_25': '98831F3A-фубар@crypto.org-xmrseed-25[1,4,1100].pws',
|
||||
'ref_passwdfile_hex2bip39_12': '98831F3A-фубар@crypto.org-hex2bip39-12[1,4,1100].pws',
|
||||
'ref_tx_file': { # data shared with ref_altcoin, autosign
|
||||
'btc': (
|
||||
'0B8D5A[15.31789,14,tl=1320969600].rawtx',
|
||||
'0C7115[15.86255,14,tl=1320969600].testnet.rawtx'
|
||||
),
|
||||
'ltc': (
|
||||
'AF3CDF-LTC[620.76194,1453,tl=1320969600].rawtx',
|
||||
'A5A1E0-LTC[1454.64322,1453,tl=1320969600].testnet.rawtx'
|
||||
),
|
||||
'bch': (
|
||||
'460D4D-BCH[10.19764,tl=1320969600].rawtx',
|
||||
'359FD5-BCH[6.68868,tl=1320969600].testnet.rawtx'
|
||||
),
|
||||
'eth': (
|
||||
'88FEFD-ETH[23.45495,40000].rawtx',
|
||||
'76CF8C-ETH[99.99895,50000].regtest.rawtx'
|
||||
),
|
||||
'mm1': (
|
||||
'5881D2-MM1[1.23456,50000].rawtx',
|
||||
'6BDB25-MM1[1.23456,50000].testnet.rawtx'
|
||||
),
|
||||
'etc': (
|
||||
'ED3848-ETC[1.2345,40000].rawtx',
|
||||
''
|
||||
)
|
||||
},
|
||||
}
|
||||
chk_data = {
|
||||
'ref_subwallet_sid': {
|
||||
|
|
@ -155,7 +129,6 @@ class CmdTestRef(CmdTestBase, CmdTestShared):
|
|||
|
||||
# Create the fake inputs:
|
||||
# ('txcreate8', 'transaction creation (8)'),
|
||||
('ref_tx_chk', 'signing saved reference tx file'),
|
||||
('ref_brain_chk_spc3', 'saved brainwallet (non-standard spacing)'),
|
||||
('ref_dieroll_chk_seedtruncate', 'saved dieroll wallet with extra entropy bits'),
|
||||
)
|
||||
|
|
@ -309,18 +282,55 @@ class CmdTestRef(CmdTestBase, CmdTestShared):
|
|||
def ref_passwdfile_chk_hex2bip39_12(self):
|
||||
return self.ref_passwdfile_chk(key='hex2bip39_12', pat=r'BIP39.*len.* 12\b')
|
||||
|
||||
def ref_tx_chk(self):
|
||||
fn = self.sources['ref_tx_file'][self.coin][bool(self.tn_ext)]
|
||||
if not fn:
|
||||
return
|
||||
tf = joinpath(ref_dir, self.ref_subdir, fn)
|
||||
wf = dfl_words_file
|
||||
self.write_to_tmpfile(pwfile, wpasswd)
|
||||
return self.txsign(wf, tf, save=False, has_label=True, view='y')
|
||||
|
||||
def ref_brain_chk_spc3(self):
|
||||
return self.ref_brain_chk(bw_file=ref_bw_file_spc)
|
||||
|
||||
def ref_dieroll_chk_seedtruncate(self):
|
||||
wf = joinpath(ref_dir, 'overflow128.b6d')
|
||||
return self.walletchk(wf, sid='8EC6D4A2')
|
||||
|
||||
class CmdTestRefTX(CmdTestRef):
|
||||
'saved reference transaction files'
|
||||
color = True
|
||||
networks = ('btc',) # other networks handled by ref_altcoin
|
||||
|
||||
cmd_group = (
|
||||
('ref_txfile_sign', 'signing saved reference tx file'),
|
||||
)
|
||||
|
||||
sources = {
|
||||
'ref_tx_file': { # data shared with ref_altcoin, autosign
|
||||
'btc': (
|
||||
'0B8D5A[15.31789,14,tl=1320969600].rawtx',
|
||||
'0C7115[15.86255,14,tl=1320969600].testnet.rawtx',
|
||||
),
|
||||
'ltc': (
|
||||
'AF3CDF-LTC[620.76194,1453,tl=1320969600].rawtx',
|
||||
'A5A1E0-LTC[1454.64322,1453,tl=1320969600].testnet.rawtx'
|
||||
),
|
||||
'bch': (
|
||||
'460D4D-BCH[10.19764,tl=1320969600].rawtx',
|
||||
'359FD5-BCH[6.68868,tl=1320969600].testnet.rawtx'
|
||||
),
|
||||
'eth': (
|
||||
'88FEFD-ETH[23.45495,40000].rawtx',
|
||||
'76CF8C-ETH[99.99895,50000].regtest.rawtx'
|
||||
),
|
||||
'mm1': (
|
||||
'5881D2-MM1[1.23456,50000].rawtx',
|
||||
'6BDB25-MM1[1.23456,50000].testnet.rawtx'
|
||||
),
|
||||
'etc': (
|
||||
'ED3848-ETC[1.2345,40000].rawtx',
|
||||
''
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
def _get_txfile(self, idx):
|
||||
return joinpath(ref_dir, self.ref_subdir, self.sources['ref_tx_file'][self.coin][idx])
|
||||
|
||||
def ref_txfile_sign(self):
|
||||
self.write_to_tmpfile(pwfile, wpasswd)
|
||||
idx = 1 if self.tn_ext else 0
|
||||
return self.txsign(dfl_words_file, self._get_txfile(idx), save=False, has_label=True, view='y')
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ test.cmdtest_d.ref_altcoin: Altcoin reference file tests for the cmdtest.py test
|
|||
|
||||
from .include.common import pwfile, dfl_wpasswd, ref_dir, dfl_words_file, dfl_addr_idx_list
|
||||
from ..include.common import joinpath, start_test_daemons, stop_test_daemons, cmp_or_die
|
||||
from .ref import CmdTestRef
|
||||
from .ref import CmdTestRef, CmdTestRefTX
|
||||
from .base import CmdTestBase
|
||||
|
||||
class CmdTestRefAltcoin(CmdTestRef, CmdTestBase):
|
||||
|
|
@ -86,8 +86,10 @@ class CmdTestRefAltcoin(CmdTestRef, CmdTestBase):
|
|||
self.write_to_tmpfile(pwfile, dfl_wpasswd)
|
||||
passfile = joinpath(self.tmpdir, pwfile)
|
||||
from mmgen.tx.file import MMGenTxFile
|
||||
src = CmdTestRef.sources['ref_tx_file']
|
||||
src = CmdTestRefTX.sources['ref_tx_file']
|
||||
for coin, files in src.items():
|
||||
if coin == 'btc':
|
||||
continue
|
||||
if coin == 'mm1':
|
||||
coin = 'eth'
|
||||
token_desc = ':MM1'
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ init_tests() {
|
|||
- $cmdtest_py main
|
||||
- $cmdtest_py conv
|
||||
- $cmdtest_py ref
|
||||
- $cmdtest_py ref_tx
|
||||
- $cmdtest_py ref3
|
||||
- $cmdtest_py ref3_addr
|
||||
- $cmdtest_py ref3_pw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue