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

Function start_node_with_clnrest

tests/test_clnrest.py:135–153  ·  view source on GitHub ↗

Start a node with the clnrest plugin, whose options are the default options. Return: - the node, - the base url and - the certificate authority path used for the self-signed certificates.

(node_factory, plugin=None, protocol='https')

Source from the content-addressed store, hash-verified

133
134
135def start_node_with_clnrest(node_factory, plugin=None, protocol='https'):
136 """Start a node with the clnrest plugin, whose options are the default options.
137 Return:
138 - the node,
139 - the base url and
140 - the certificate authority path used for the self-signed certificates."""
141 rest_port = str(node_factory.get_unused_port())
142 rest_certs = node_factory.directory + '/clnrest-certs'
143 options = {'clnrest-port': rest_port, 'clnrest-certs': rest_certs,
144 'clnrest-protocol': protocol}
145 if plugin is not None:
146 options['plugin'] = plugin
147 l1 = node_factory.get_node(options=options)
148 base_url = f'{protocol}://127.0.0.1:' + rest_port
149 # This might happen really early!
150 l1.daemon.logsearch_start = 0
151 l1.daemon.wait_for_log(r'plugin-clnrest: REST server running at ' + base_url)
152 ca_cert = Path(rest_certs) / 'ca.pem'
153 return l1, base_url, ca_cert
154
155
156def test_list_methods(node_factory):

Callers 15

test_list_methodsFunction · 0.85
test_unknown_methodFunction · 0.85
test_rpc_methodFunction · 0.85
test_large_responseFunction · 0.85
test_websocket_no_runeFunction · 0.85
test_http_headersFunction · 0.85

Calls 3

get_unused_portMethod · 0.80
wait_for_logMethod · 0.80
get_nodeMethod · 0.45

Tested by

no test coverage detected