Skip to content

Commit

Permalink
test_lightningd.py: Test delexpiredinvoice.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZmnSCPxj authored and cdecker committed Mar 20, 2018
1 parent 3b0081a commit de853b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_lightningd.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ def test_invoice_expiry(self):
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')
Expand All @@ -471,6 +472,16 @@ def test_invoice_expiry(self):
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()

Expand Down

0 comments on commit de853b4

Please sign in to comment.