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)
| 6016 | |
| 6017 | |
| 6018 | def 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 | ) |
nothing calls this directly
no test coverage detected