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

Function test_command_collision

tests/test_plugin.py:6018–6044  ·  view source on GitHub ↗

We add a new method with the inline plugin. Then try to register the same method with another dynamic plugin. lightningd should report back a name collision.

(node_factory)

Source from the content-addressed store, hash-verified

6016
6017
6018def test_command_collision(node_factory):
6019 """We add a new method with the inline plugin. Then try to register the same
6020 method with another dynamic plugin. lightningd should report back a name
6021 collision."""
6022
6023 def some_plugin(plugin):
6024 @plugin.method("myrpcmethod")
6025 def on_mymethod(plugin):
6026 return {}
6027
6028 l1 = node_factory.get_node(inline_plugin=some_plugin)
6029
6030 # try register plugin with "myrpcmethod" collision
6031 with pytest.raises(
6032 RpcError, match="a method with that name is already registered by plugin"
6033 ):
6034 l1.rpc.plugin_start(
6035 plugin=os.path.join(os.getcwd(), "tests/plugins/method_collision.py")
6036 )
6037
6038 # try register plugin with "getinfo" method which is builtin
6039 with pytest.raises(
6040 RpcError, match="a builtin method with that name is already registered"
6041 ):
6042 l1.rpc.plugin_start(
6043 plugin=os.path.join(os.getcwd(), "tests/plugins/builtin_collision.py")
6044 )

Callers

nothing calls this directly

Calls 3

plugin_startMethod · 0.80
joinMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected