Skip to content

Commit 6391645

Browse files
ZmnSCPxjrustyrussell
authored andcommitted
test_lightningd: Check payment fields of pay return value.
1 parent 881eb80 commit 6391645

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/test_lightningd.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,16 @@ def test_pay(self):
926926

927927
inv = l2.rpc.invoice(123000, 'test_pay', 'description')['bolt11']
928928
before = int(time.time())
929-
preimage = l1.rpc.pay(inv)
929+
details = l1.rpc.pay(inv)
930930
after = int(time.time())
931-
invoice = l2.rpc.listinvoices('test_pay')['invoices'][0]
931+
preimage = details['payment_preimage']
932+
assert details['status'] == 'complete'
933+
assert details['msatoshi'] == 123000
934+
assert details['destination'] == l2.info['id']
935+
assert details['created_at'] >= before
936+
assert details['created_at'] <= after
932937

938+
invoice = l2.rpc.listinvoices('test_pay')['invoices'][0]
933939
assert invoice['status'] == 'paid'
934940
assert invoice['paid_at'] >= before
935941
assert invoice['paid_at'] <= after
@@ -957,7 +963,7 @@ def test_pay(self):
957963

958964
# Test listpayments indexed by bolt11.
959965
assert len(l1.rpc.listpayments(inv)['payments']) == 1
960-
assert l1.rpc.listpayments(inv)['payments'][0]['payment_preimage'] == preimage['payment_preimage']
966+
assert l1.rpc.listpayments(inv)['payments'][0]['payment_preimage'] == preimage
961967

962968
def test_pay_optional_args(self):
963969
l1, l2 = self.connect()

0 commit comments

Comments
 (0)