From 6391645b83742013ad63aa159c8b307d238c93c3 Mon Sep 17 00:00:00 2001 From: ZmnSCPxj Date: Wed, 14 Mar 2018 11:55:19 +0000 Subject: [PATCH] test_lightningd: Check payment fields of pay return value. --- tests/test_lightningd.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_lightningd.py b/tests/test_lightningd.py index d2bf82fbe..5cbd57ab5 100644 --- a/tests/test_lightningd.py +++ b/tests/test_lightningd.py @@ -926,10 +926,16 @@ class LightningDTests(BaseLightningDTests): inv = l2.rpc.invoice(123000, 'test_pay', 'description')['bolt11'] before = int(time.time()) - preimage = l1.rpc.pay(inv) + details = l1.rpc.pay(inv) after = int(time.time()) - invoice = l2.rpc.listinvoices('test_pay')['invoices'][0] + preimage = details['payment_preimage'] + assert details['status'] == 'complete' + assert details['msatoshi'] == 123000 + assert details['destination'] == l2.info['id'] + assert details['created_at'] >= before + assert details['created_at'] <= after + invoice = l2.rpc.listinvoices('test_pay')['invoices'][0] assert invoice['status'] == 'paid' assert invoice['paid_at'] >= before assert invoice['paid_at'] <= after @@ -957,7 +963,7 @@ class LightningDTests(BaseLightningDTests): # Test listpayments indexed by bolt11. assert len(l1.rpc.listpayments(inv)['payments']) == 1 - assert l1.rpc.listpayments(inv)['payments'][0]['payment_preimage'] == preimage['payment_preimage'] + assert l1.rpc.listpayments(inv)['payments'][0]['payment_preimage'] == preimage def test_pay_optional_args(self): l1, l2 = self.connect()