MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_invoice_weirdstring

Function test_invoice_weirdstring

tests/test_invoices.py:91–131  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

89
90
91def test_invoice_weirdstring(node_factory):
92 l1 = node_factory.get_node()
93
94 weird_label = 'label \\ " \t \n'
95 weird_desc = 'description \\ " \t \n'
96 l1.rpc.invoice(123000, weird_label, weird_desc)
97 # FIXME: invoice RPC should return label!
98
99 # Can find by this label.
100 inv = only_one(l1.rpc.listinvoices(weird_label)['invoices'])
101 assert inv['label'] == weird_label
102
103 # Can find this in list.
104 inv = only_one(l1.rpc.listinvoices()['invoices'])
105 assert inv['label'] == weird_label
106
107 b11 = l1.rpc.decode(inv['bolt11'])
108 assert b11['description'] == weird_desc
109
110 # Can delete by weird label.
111 l1.rpc.delinvoice(weird_label, "unpaid")
112
113 # We can also use numbers as labels.
114 weird_label = 25
115 weird_desc = '"'
116 l1.rpc.invoice(123000, weird_label, weird_desc)
117 # FIXME: invoice RPC should return label!
118
119 # Can find by this label.
120 inv = only_one(l1.rpc.listinvoices(weird_label)['invoices'])
121 assert inv['label'] == str(weird_label)
122
123 # Can find this in list.
124 inv = only_one(l1.rpc.listinvoices()['invoices'])
125 assert inv['label'] == str(weird_label)
126
127 b11 = l1.rpc.decode(inv['bolt11'])
128 assert b11['description'] == weird_desc
129
130 # Can delete by weird label.
131 l1.rpc.delinvoice(weird_label, "unpaid")
132
133
134def test_invoice_preimage(node_factory):

Callers

nothing calls this directly

Calls 6

only_oneFunction · 0.90
delinvoiceMethod · 0.80
get_nodeMethod · 0.45
invoiceMethod · 0.45
listinvoicesMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected