tests/clnrest: Test to confirm that `msat` suffix has been removed from notifications

This commit is contained in:
ShahanaFarooqui 2023-11-21 11:02:03 +10:30 committed by Peter Neuroth
parent 2a7a3d2371
commit fdc7fcbf34
1 changed files with 23 additions and 0 deletions

View File

@ -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