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

Function test_options

tests/test_clnrest.py:434–453  ·  view source on GitHub ↗

Test startup options `clnrest-host`, `clnrest-protocol` and `clnrest-certs`.

(node_factory)

Source from the content-addressed store, hash-verified

432
433
434def test_options(node_factory):
435 """Test startup options `clnrest-host`, `clnrest-protocol` and `clnrest-certs`."""
436 # with invalid port
437 rest_port = 1000
438 l1 = node_factory.get_node(options={'clnrest-port': rest_port})
439 assert l1.daemon.is_in_log(f'plugin-clnrest: Killing plugin: disabled itself at init: `clnrest-port` {rest_port}, should be a valid available port between 1024 and 65535.')
440
441 # with invalid protocol
442 rest_port = str(node_factory.get_unused_port())
443 rest_protocol = 'htttps'
444 l1 = node_factory.get_node(options={'clnrest-port': rest_port,
445 'clnrest-protocol': rest_protocol})
446 assert l1.daemon.is_in_log(r'plugin-clnrest: Killing plugin: disabled itself at init: `clnrest-protocol` can either be http or https.')
447
448 # with invalid host
449 rest_port = str(node_factory.get_unused_port())
450 rest_host = '127.0.0.12.15'
451 l1 = node_factory.get_node(options={'clnrest-port': rest_port,
452 'clnrest-host': rest_host})
453 assert l1.daemon.is_in_log(r'plugin-clnrest: Killing plugin: disabled itself at init: `clnrest-host` should be a valid IP.')
454
455
456def test_http_headers(node_factory):

Callers

nothing calls this directly

Calls 3

is_in_logMethod · 0.80
get_unused_portMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected