Browse Source

regests: organize tests in two classes

hard-fail-on-bad-server-string
ThomasV 5 years ago
parent
commit
73e656522e
  1. 21
      electrum/tests/regtest.py

21
electrum/tests/regtest.py

@ -17,9 +17,6 @@ class TestLightning(unittest.TestCase):
def setUp(self): def setUp(self):
test_name = self.id().split('.')[-1] test_name = self.id().split('.')[-1]
sys.stdout.write("***** %s ******\n" % test_name) sys.stdout.write("***** %s ******\n" % test_name)
self.agents = ['alice', 'bob']
if test_name in ['test_forwarding', 'test_watchtower']:
self.agents.append('carol')
# initialize and get funds # initialize and get funds
for agent in self.agents: for agent in self.agents:
self.run_shell(['init', agent]) self.run_shell(['init', agent])
@ -35,14 +32,13 @@ class TestLightning(unittest.TestCase):
for agent in self.agents: for agent in self.agents:
self.run_shell(['stop', agent]) self.run_shell(['stop', agent])
class TestLightningAB(TestLightning):
agents = ['alice', 'bob']
def test_breach(self): def test_breach(self):
self.run_shell(['breach']) 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): def test_redeem_htlcs(self):
self.run_shell(['redeem_htlcs']) self.run_shell(['redeem_htlcs'])
@ -52,5 +48,14 @@ class TestLightning(unittest.TestCase):
def test_breach_with_spent_htlc(self): def test_breach_with_spent_htlc(self):
self.run_shell(['breach_with_spent_htlc']) self.run_shell(['breach_with_spent_htlc'])
class TestLightningABC(TestLightning):
agents = ['alice', 'bob', 'carol']
def test_forwarding(self):
self.run_shell(['open'])
self.run_shell(['alice_pays_carol'])
self.run_shell(['close'])
def test_watchtower(self): def test_watchtower(self):
self.run_shell(['watchtower']) self.run_shell(['watchtower'])

Loading…
Cancel
Save