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

Function test_pyln_request_notify

tests/test_plugin.py:3033–3055  ·  view source on GitHub ↗

Test that pyln-client plugins can send notifications.

(node_factory)

Source from the content-addressed store, hash-verified

3031
3032
3033def test_pyln_request_notify(node_factory):
3034 """Test that pyln-client plugins can send notifications.
3035 """
3036 plugin_path = os.path.join(
3037 os.path.dirname(__file__), 'plugins/countdown.py'
3038 )
3039 l1 = node_factory.get_node(options={'plugin': plugin_path})
3040 notifications = []
3041
3042 def n(*args, message, **kwargs):
3043 print("Got a notification:", message)
3044 notifications.append(message)
3045
3046 with l1.rpc.notify(n):
3047 l1.rpc.countdown(10)
3048
3049 expected = ['{}/10'.format(i) for i in range(10)]
3050 assert expected == notifications
3051
3052 # Calling without the context manager we should not get any notifications
3053 notifications = []
3054 l1.rpc.countdown(10)
3055 assert notifications == []
3056
3057
3058def test_self_disable(node_factory):

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
get_nodeMethod · 0.45
notifyMethod · 0.45

Tested by

no test coverage detected