mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-23 16:14:20 +01:00
autopilot: adds basic tests to ensure plugin is runable
This commit is contained in:
23
autopilot/test_autopilot.py
Normal file
23
autopilot/test_autopilot.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import os
|
||||||
|
from pyln.testing.fixtures import * # noqa: F401,F403
|
||||||
|
|
||||||
|
plugin_path = os.path.join(os.path.dirname(__file__), "autopilot.py")
|
||||||
|
plugin_opt = {'plugin': plugin_path}
|
||||||
|
|
||||||
|
|
||||||
|
def test_starts(node_factory):
|
||||||
|
l1 = node_factory.get_node()
|
||||||
|
# Test dynamically
|
||||||
|
l1.rpc.plugin_start(plugin_path)
|
||||||
|
l1.rpc.plugin_stop(plugin_path)
|
||||||
|
l1.rpc.plugin_start(plugin_path)
|
||||||
|
l1.stop()
|
||||||
|
# Then statically
|
||||||
|
l1.daemon.opts["plugin"] = plugin_path
|
||||||
|
l1.start()
|
||||||
|
|
||||||
|
|
||||||
|
def test_main(node_factory):
|
||||||
|
l1, l2 = node_factory.line_graph(2, wait_for_announce=True, opts=plugin_opt)
|
||||||
|
# just call main function
|
||||||
|
assert l1.rpc.autopilot_run_once()
|
||||||
Reference in New Issue
Block a user