Browse Source

test.py input: add 'get_seed_from_stdin' test

The MMGen Project 3 years ago
parent
commit
3a1ba61fc2
1 changed files with 13 additions and 0 deletions
  1. 13 0
      test/test_py_d/ts_input.py

+ 13 - 0
test/test_py_d/ts_input.py

@@ -21,6 +21,7 @@ class TestSuiteInput(TestSuiteBase):
 	tmpdir_nums = []
 	tmpdir_nums = []
 	color = True
 	color = True
 	cmd_group = (
 	cmd_group = (
+		('get_seed_from_stdin',           (1,'reading seed phrase from STDIN', [])),
 		('get_passphrase_ui',             (1,"hash preset, password and label (wallet.py)", [])),
 		('get_passphrase_ui',             (1,"hash preset, password and label (wallet.py)", [])),
 		('get_passphrase_cmdline',        (1,"hash preset, password and label (wallet.py - from cmdline)", [])),
 		('get_passphrase_cmdline',        (1,"hash preset, password and label (wallet.py - from cmdline)", [])),
 		('get_passphrase_crypto',         (1,"hash preset, password and label (crypto.py)", [])),
 		('get_passphrase_crypto',         (1,"hash preset, password and label (crypto.py)", [])),
@@ -41,6 +42,18 @@ class TestSuiteInput(TestSuiteBase):
 		('dieroll_entry_usrrand',         (1,"dieroll entry (base6d) with added user entropy", [])),
 		('dieroll_entry_usrrand',         (1,"dieroll entry (base6d) with added user entropy", [])),
 	)
 	)
 
 
+	def get_seed_from_stdin(self):
+		self.spawn('',msg_only=True)
+		from subprocess import run,PIPE
+		cmd = ['cmds/mmgen-walletconv','--in-fmt=words','--out-fmt=bip39','--outdir=test/trash']
+		mn = sample_mn['mmgen']['mn']
+		os.environ['MMGEN_TEST_SUITE'] = ''
+		cp = run( cmd, input=mn.encode(), stdout=PIPE, stderr=PIPE )
+		os.environ['MMGEN_TEST_SUITE'] = '1'
+		assert b'written to file' in cp.stderr, "test 'get_seed_from_stdin' failed"
+		imsg(cp.stderr.decode().strip())
+		return 'ok'
+
 	def get_passphrase_ui(self):
 	def get_passphrase_ui(self):
 		t = self.spawn('test/misc/get_passphrase.py',['--usr-randchars=0','seed'],cmd_dir='.')
 		t = self.spawn('test/misc/get_passphrase.py',['--usr-randchars=0','seed'],cmd_dir='.')