forked from spesmilo/electrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregtest.py
More file actions
42 lines (32 loc) · 1.18 KB
/
regtest.py
File metadata and controls
42 lines (32 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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(['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'])
def test_watchtower(self):
self.run_shell(['watchtower'])