From 131283af6ec59eacfeb20324ba7bfd07612c0d32 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Wed, 31 Jan 2018 01:36:55 +0000 Subject: [PATCH] test_lightningd: Move 0-payment test to its own test. --- tests/test_lightningd.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index 0fb652818..46466acc5 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -776,6 +776,21 @@ class LightningDTests(BaseLightningDTests): # But this should work. self.pay(l2, l1, available - reserve*2) + def test_pay0(self): + """Test paying 0 amount + """ + l1,l2 = self.connect() + # Set up channel. + chanid = self.fund_channel(l1, l2, 10**6) + self.wait_for_routes(l1, [chanid]) + + # Get any-amount invoice + inv = l2.rpc.invoice("any", "any", 'description')['bolt11'] + + # Amount must be nonzero! + self.assertRaisesRegex(ValueError, 'WIRE_AMOUNT_BELOW_MINIMUM', + l1.rpc.pay, inv, 0) + def test_pay(self): l1,l2 = self.connect() @@ -811,9 +826,6 @@ class LightningDTests(BaseLightningDTests): # Must provide an amount! self.assertRaises(ValueError, l1.rpc.pay, inv2) self.assertRaises(ValueError, l1.rpc.pay, inv2, None) - # Amount must be nonzero! - self.assertRaisesRegex(ValueError, 'WIRE_AMOUNT_BELOW_MINIMUM', - l1.rpc.pay, inv2, 0) l1.rpc.pay(inv2, random.randint(1000, 999999)) # Should see 6 completed payments