cmdtest.py: mv tool_decrypt_ref test to tool group
This commit is contained in:
parent
2bc8a5dda4
commit
e1d715ea76
2 changed files with 29 additions and 23 deletions
|
|
@ -23,13 +23,10 @@ test.cmdtest_d.ref: Reference file tests for the cmdtest.py test suite
|
|||
from mmgen.util import capfirst
|
||||
from mmgen.wallet import get_wallet_cls
|
||||
from ..include.common import (
|
||||
imsg_r,
|
||||
ok,
|
||||
joinpath,
|
||||
cmp_or_die,
|
||||
ref_kafile_pass,
|
||||
read_from_file,
|
||||
sample_text
|
||||
)
|
||||
from .include.common import (
|
||||
dfl_words_file,
|
||||
|
|
@ -37,9 +34,6 @@ from .include.common import (
|
|||
chksum_pat,
|
||||
pwfile,
|
||||
ref_bw_file_spc,
|
||||
ref_enc_fn,
|
||||
cleanup_env,
|
||||
tool_enc_passwd,
|
||||
skip
|
||||
)
|
||||
|
||||
|
|
@ -164,7 +158,6 @@ class CmdTestRef(CmdTestBase, CmdTestShared):
|
|||
('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'),
|
||||
('ref_tool_decrypt', 'decryption of saved MMGen-encrypted file'),
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
@ -331,17 +324,3 @@ class CmdTestRef(CmdTestBase, CmdTestShared):
|
|||
def ref_dieroll_chk_seedtruncate(self):
|
||||
wf = joinpath(ref_dir, 'overflow128.b6d')
|
||||
return self.walletchk(wf, sid='8EC6D4A2')
|
||||
|
||||
def ref_tool_decrypt(self):
|
||||
f = joinpath(ref_dir, ref_enc_fn)
|
||||
dec_file = joinpath(self.tmpdir, 'famous.txt')
|
||||
t = self.spawn(
|
||||
'mmgen-tool',
|
||||
['-q', 'decrypt', f, 'outfile='+dec_file, 'hash_preset=1'],
|
||||
env = cleanup_env(self.cfg))
|
||||
t.passphrase('data', tool_enc_passwd)
|
||||
t.written_to_file('Decrypted data')
|
||||
dec_txt = read_from_file(dec_file)
|
||||
imsg_r(dec_txt)
|
||||
cmp_or_die(sample_text+'\n', dec_txt) # file adds a newline to sample_text
|
||||
return t
|
||||
|
|
|
|||
|
|
@ -18,13 +18,23 @@ from mmgen.color import cyan
|
|||
|
||||
from ..include.common import (
|
||||
vmsg,
|
||||
imsg_r,
|
||||
read_from_file,
|
||||
write_to_file,
|
||||
cmp_or_die,
|
||||
joinpath,
|
||||
getrand
|
||||
getrand,
|
||||
sample_text
|
||||
)
|
||||
from .include.common import (
|
||||
hincog_fn,
|
||||
incog_id_fn,
|
||||
hincog_offset,
|
||||
tool_enc_passwd,
|
||||
ref_dir,
|
||||
ref_enc_fn,
|
||||
cleanup_env,
|
||||
)
|
||||
from .include.common import hincog_fn, incog_id_fn, hincog_offset, tool_enc_passwd, ref_dir
|
||||
from .base import CmdTestBase
|
||||
from .main import CmdTestMain
|
||||
|
||||
|
|
@ -57,6 +67,9 @@ class CmdTestTool(CmdTestMain, CmdTestBase):
|
|||
('tool_decrypt_geth_keystore',
|
||||
(9, '‘mmgen-tool decrypt_geth_keystore’', [])
|
||||
),
|
||||
('tool_decrypt_ref',
|
||||
(9, '‘mmgen-tool decrypt’ on saved reference file', [])
|
||||
),
|
||||
('tool_api',
|
||||
(9, 'tool API (initialization, config methods, wif2addr)', [])
|
||||
),
|
||||
|
|
@ -140,6 +153,20 @@ class CmdTestTool(CmdTestMain, CmdTestBase):
|
|||
pw = '',
|
||||
chk = '9627ddb68354f5e0ff45fb2da49d7a20a013b7257a83ef4adbbbd87aeaccc75e')
|
||||
|
||||
def tool_decrypt_ref(self):
|
||||
f = joinpath(ref_dir, ref_enc_fn)
|
||||
dec_file = joinpath(self.tmpdir, 'famous.txt')
|
||||
t = self.spawn(
|
||||
'mmgen-tool',
|
||||
['-q', 'decrypt', f, 'outfile='+dec_file, 'hash_preset=1'],
|
||||
env = cleanup_env(self.cfg))
|
||||
t.passphrase('data', tool_enc_passwd)
|
||||
t.written_to_file('Decrypted data')
|
||||
dec_txt = read_from_file(dec_file)
|
||||
imsg_r(dec_txt)
|
||||
cmp_or_die(sample_text+'\n', dec_txt) # file adds a newline to sample_text
|
||||
return t
|
||||
|
||||
def tool_api(self):
|
||||
t = self.spawn(
|
||||
'tool_api_test.py',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue