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

Function test_all_subscription

tests/test_plugin.py:4577–4603  ·  view source on GitHub ↗

Ensure that registering for all notifications works.

(node_factory, directory)

Source from the content-addressed store, hash-verified

4575
4576
4577def test_all_subscription(node_factory, directory):
4578 """Ensure that registering for all notifications works."""
4579 plugin1 = os.path.join(os.getcwd(), 'tests/plugins/all_notifications.py')
4580 plugin2 = os.path.join(os.getcwd(), "tests/plugins/test_libplugin")
4581
4582 l1, l2 = node_factory.line_graph(2, opts=[{"plugin": plugin1},
4583 {"plugin": plugin2}])
4584
4585 l1.stop()
4586 l2.stop()
4587
4588 # There will be a lot of these!
4589 for notstr in ("block_added: {'block_added': {'hash': ",
4590 "balance_snapshot: {'balance_snapshot': {'node_id': ",
4591 "connect: {'connect': {'id': ",
4592 "channel_state_changed: {'channel_state_changed': {'peer_id': ",
4593 "shutdown: {'shutdown': {}"):
4594 assert l1.daemon.is_in_log(f".*plugin-all_notifications.py: notification {notstr}.*")
4595
4596 for notstr in ('block_added: ',
4597 'balance_snapshot: ',
4598 'channel_state_changed: {'):
4599 assert l2.daemon.is_in_log(f'.*test_libplugin: all: {notstr}.*')
4600
4601 # shutdown and connect are subscribed before the wildcard, so is handled by that handler
4602 assert not l2.daemon.is_in_log(f'.*test_libplugin: all: shutdown.*')
4603 assert not l2.daemon.is_in_log(f'.*test_libplugin: all: connect.*')
4604
4605
4606def test_dynamic_option_python_plugin(node_factory):

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
line_graphMethod · 0.80
is_in_logMethod · 0.80
stopMethod · 0.45

Tested by

no test coverage detected