Skip to content

Commit

Permalink
tests/clnrest: Added rpc method name and params to use the same `noti…
Browse files Browse the repository at this point in the history
…fications_received_via_websocket` function for other rpc requests too
  • Loading branch information
ShahanaFarooqui authored and nepet committed Nov 21, 2023
1 parent 8aff6f7 commit 2a7a3d2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_clnrest.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def test_clnrest_large_response(node_factory):
# to complain with the errors F811 like this "F811 redefinition of
# unused 'message'".

def notifications_received_via_websocket(l1, base_url, http_session):
def notifications_received_via_websocket(l1, base_url, http_session, rpc_method='invoice', rpc_params=[100000, 'label', 'description']):
"""Return the list of notifications received by the websocket client.
We try to connect to the websocket server running at `base_url`
Expand All @@ -271,8 +271,9 @@ def message(data):
notifications.append(data)
sio.connect(base_url)
time.sleep(2)
# trigger `invoice_creation` notification
l1.rpc.invoice(10000, "label", "description")
# trigger notification by calling method
rpc_call = getattr(l1.rpc, rpc_method)
rpc_call(*rpc_params)
time.sleep(2)
sio.disconnect()
return notifications
Expand Down

0 comments on commit 2a7a3d2

Please sign in to comment.