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

Function test_enableoffer

tests/test_pay.py:6183–6210  ·  view source on GitHub ↗
(node_factory)

Source from the content-addressed store, hash-verified

6181
6182
6183def test_enableoffer(node_factory):
6184 l1, l2 = node_factory.line_graph(2)
6185
6186 # Normal offer, works as expected
6187 offer1 = l2.rpc.call('offer', {'amount': '2msat',
6188 'description': 'test_disableoffer_reenable'})
6189 assert offer1['created'] is True
6190 l1.rpc.fetchinvoice(offer=offer1['bolt12'])
6191
6192 l2.rpc.disableoffer(offer_id=offer1['offer_id'])
6193
6194 with pytest.raises(RpcError, match="Offer no longer available"):
6195 l1.rpc.fetchinvoice(offer=offer1['bolt12'])
6196
6197 with pytest.raises(RpcError, match="1000.*Already exists, but isn't active"):
6198 l2.rpc.call('offer', {'amount': '2msat',
6199 'description': 'test_disableoffer_reenable'})
6200
6201 l2.rpc.enableoffer(offer_id=offer1['offer_id'])
6202 l1.rpc.fetchinvoice(offer=offer1['bolt12'])
6203
6204 # Can't enable twice.
6205 with pytest.raises(RpcError, match="1006.*offer already active"):
6206 l2.rpc.enableoffer(offer_id=offer1['offer_id'])
6207
6208 # Can't enable unknown.
6209 with pytest.raises(RpcError, match="Unknown offer"):
6210 l1.rpc.enableoffer(offer_id=offer1['offer_id'])
6211
6212
6213def test_offer_with_private_channels_multyhop2(node_factory):

Callers

nothing calls this directly

Calls 5

line_graphMethod · 0.80
fetchinvoiceMethod · 0.80
disableofferMethod · 0.80
enableofferMethod · 0.80
callMethod · 0.45

Tested by

no test coverage detected