mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-02 18:35:00 +01:00
pytest: Give each run of the hsmtool its own pty
This commit is contained in:
parent
1463797c61
commit
5ecaff65ee
1 changed files with 7 additions and 1 deletions
|
@ -1024,6 +1024,7 @@ def test_hsmtool_secret_decryption(node_factory):
|
|||
l1.stop()
|
||||
|
||||
# We can't use a wrong password !
|
||||
master_fd, slave_fd = os.openpty()
|
||||
hsmtool = HsmTool("decrypt", hsm_path)
|
||||
hsmtool.start(stdin=slave_fd,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -1033,6 +1034,7 @@ def test_hsmtool_secret_decryption(node_factory):
|
|||
hsmtool.is_in_log(r"Wrong password")
|
||||
|
||||
# Decrypt it with hsmtool
|
||||
master_fd, slave_fd = os.openpty()
|
||||
hsmtool.start(stdin=slave_fd,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
hsmtool.wait_for_log(r"Enter hsm_secret password:")
|
||||
|
@ -1045,6 +1047,7 @@ def test_hsmtool_secret_decryption(node_factory):
|
|||
l1.stop()
|
||||
|
||||
# Test we can encrypt it offline
|
||||
master_fd, slave_fd = os.openpty()
|
||||
hsmtool = HsmTool("encrypt", hsm_path)
|
||||
hsmtool.start(stdin=slave_fd,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -1073,6 +1076,7 @@ def test_hsmtool_secret_decryption(node_factory):
|
|||
l1.stop()
|
||||
|
||||
# And finally test that we can also decrypt if encrypted with hsmtool
|
||||
master_fd, slave_fd = os.openpty()
|
||||
hsmtool = HsmTool("decrypt", hsm_path)
|
||||
hsmtool.start(stdin=slave_fd,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -1119,16 +1123,18 @@ def test_hsmtool_generatehsm(node_factory):
|
|||
l1.stop()
|
||||
hsm_path = os.path.join(l1.daemon.lightning_dir, TEST_NETWORK,
|
||||
"hsm_secret")
|
||||
master_fd, slave_fd = os.openpty()
|
||||
|
||||
hsmtool = HsmTool("generatehsm", hsm_path)
|
||||
|
||||
# You cannot re-generate an already existing hsm_secret
|
||||
master_fd, slave_fd = os.openpty()
|
||||
hsmtool.start(stdin=slave_fd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
assert hsmtool.proc.wait(WAIT_TIMEOUT) == 2
|
||||
os.remove(hsm_path)
|
||||
|
||||
# We can generate a valid hsm_secret from a wordlist and a "passphrase"
|
||||
master_fd, slave_fd = os.openpty()
|
||||
hsmtool.start(stdin=slave_fd, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
hsmtool.wait_for_log(r"Select your language:")
|
||||
|
|
Loading…
Add table
Reference in a new issue