Browse Source

test_lightningd.py: Test delexpiredinvoice.

ppa-0.6.1
ZmnSCPxj 7 years ago
committed by Christian Decker
parent
commit
de853b4847
  1. 11
      tests/test_lightningd.py

11
tests/test_lightningd.py

@ -453,6 +453,7 @@ class LightningDTests(BaseLightningDTests):
l2.rpc.invoice('any', 'inv1', 'description', 10)
l2.rpc.invoice('any', 'inv2', 'description', 4)
l2.rpc.invoice('any', 'inv3', 'description', 16)
creation = int(time.time())
# Check waitinvoice correctly waits
w1 = self.executor.submit(l2.rpc.waitinvoice, 'inv1')
w2 = self.executor.submit(l2.rpc.waitinvoice, 'inv2')
@ -471,6 +472,16 @@ class LightningDTests(BaseLightningDTests):
time.sleep(8) # total 20
self.assertRaises(ValueError, w3.result)
# Test delexpiredinvoice
l2.rpc.delexpiredinvoice(maxexpirytime=creation + 8)
# only inv2 should have been deleted
assert len(l2.rpc.listinvoices()['invoices']) == 2
assert len(l2.rpc.listinvoices('inv2')['invoices']) == 0
# Test delexpiredinvoice all
l2.rpc.delexpiredinvoice()
# all invoices are expired and should be deleted
assert len(l2.rpc.listinvoices()['invoices']) == 0
def test_connect(self):
l1, l2 = self.connect()

Loading…
Cancel
Save