LBRY-Vault/electrum/tests/test_regtest.py
ThomasV a8ce8109be Perform breach remedy without sweepstore:
- add functions to lnsweep
 - lnworker: analyze candidate ctx and htlc_tx
 - watchtower will be optional
 - add test for breach remedy with spent htlcs
 - save tx name as label
2019-08-20 09:03:12 +02:00

40 lines
1.1 KiB
Python

import os
import sys
import unittest
import subprocess
class TestLightning(unittest.TestCase):
@staticmethod
def run_shell(args, timeout=30):
process = subprocess.Popen(['electrum/tests/regtest/regtest.sh'] + args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
for line in iter(process.stdout.readline, b''):
sys.stdout.write(line.decode(sys.stdout.encoding))
process.wait(timeout=timeout)
process.stdout.close()
assert process.returncode == 0
def setUp(self):
self.run_shell(['stop'])
self.run_shell(['init'])
self.run_shell(['start'])
def tearDown(self):
self.run_shell(['stop'])
def test_breach(self):
self.run_shell(['breach'])
def test_forwarding(self):
self.run_shell(['open'])
self.run_shell(['alice_pays_carol'])
self.run_shell(['close'])
def test_redeem_htlcs(self):
self.run_shell(['redeem_htlcs'])
def test_breach_with_unspent_htlc(self):
self.run_shell(['breach_with_unspent_htlc'])
def test_breach_with_spent_htlc(self):
self.run_shell(['breach_with_spent_htlc'])