tests/clnrest: Added rpc method name and params to use the same `notifications_received_via_websocket` function for other rpc requests too
This commit is contained in:
parent
8aff6f788f
commit
2a7a3d2371
|
@ -252,7 +252,7 @@ def test_clnrest_large_response(node_factory):
|
||||||
# to complain with the errors F811 like this "F811 redefinition of
|
# to complain with the errors F811 like this "F811 redefinition of
|
||||||
# unused 'message'".
|
# 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.
|
"""Return the list of notifications received by the websocket client.
|
||||||
|
|
||||||
We try to connect to the websocket server running at `base_url`
|
We try to connect to the websocket server running at `base_url`
|
||||||
|
@ -271,8 +271,9 @@ def notifications_received_via_websocket(l1, base_url, http_session):
|
||||||
notifications.append(data)
|
notifications.append(data)
|
||||||
sio.connect(base_url)
|
sio.connect(base_url)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
# trigger `invoice_creation` notification
|
# trigger notification by calling method
|
||||||
l1.rpc.invoice(10000, "label", "description")
|
rpc_call = getattr(l1.rpc, rpc_method)
|
||||||
|
rpc_call(*rpc_params)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
sio.disconnect()
|
sio.disconnect()
|
||||||
return notifications
|
return notifications
|
||||||
|
|
Loading…
Reference in New Issue