Skip to content

Commit

Permalink
tests/clnrest: Test to confirm that msat suffix has been removed fr…
Browse files Browse the repository at this point in the history
…om notifications
  • Loading branch information
ShahanaFarooqui authored and rustyrussell committed Nov 21, 2023
1 parent ebcc869 commit 8796536
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_clnrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,29 @@ def test_clnrest_websocket_rune_no_listnotifications(node_factory):
assert len([n for n in notifications if n.find('invoice_creation') > 0]) == 0


@pytest.mark.xfail(strict=True)
def test_clnrest_numeric_msat_notification(node_factory):
"""Test that msat fields are integers in notifications also."""
# start a node with clnrest
rest_port = str(reserve())
base_url = 'http://127.0.0.1:' + rest_port
l1, l2 = node_factory.get_nodes(2, opts=[{}, {'clnrest-port': rest_port, 'clnrest-protocol': 'http'}])
node_factory.join_nodes([l1, l2], wait_for_announce=True)
http_session = http_session_with_retry()

# create an invoice on l2
inv = l2.rpc.invoice(5000000, 'test_invoice_payment_notification', 'test_invoice_payment_notification_description')

# create rune authorizing listclnrest-notifications method
rune_clnrest_notifications = l2.rpc.createrune(restrictions=[["method=listclnrest-notifications"]])['rune']
http_session.headers.update({"rune": rune_clnrest_notifications})
notifications = notifications_received_via_websocket(l1, base_url, http_session, 'pay', [inv['bolt11']])
filtered_notifications = [n for n in notifications if 'invoice_creation' in n]

assert isinstance(filtered_notifications[0]['invoice_creation']['msat'], int)
assert filtered_notifications[0]['invoice_creation']['msat'] == 5000000


def test_clnrest_options(node_factory):
"""Test startup options `clnrest-host`, `clnrest-protocol` and `clnrest-certs`."""
# with invalid port
Expand Down

0 comments on commit 8796536

Please sign in to comment.