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

Function test_uses_grpc_plugin_certificates

tests/test_clnrest.py:60–77  ·  view source on GitHub ↗

Test that clnrest reuses `cln-grpc` plugin certificates if available. Defaults: - clnrest-protocol: https

(node_factory)

Source from the content-addressed store, hash-verified

58
59
60def test_uses_grpc_plugin_certificates(node_factory):
61 """Test that clnrest reuses `cln-grpc` plugin certificates if available.
62 Defaults:
63 - clnrest-protocol: https
64 """
65 rest_host = 'localhost'
66 grpc_port = str(node_factory.get_unused_port())
67 rest_port = str(node_factory.get_unused_port())
68 l1 = node_factory.get_node(options={'grpc-port': grpc_port, 'clnrest-host': rest_host, 'clnrest-port': rest_port})
69 base_url = f'https://{rest_host}:{rest_port}'
70 # This might happen really early!
71 l1.daemon.logsearch_start = 0
72 l1.daemon.wait_for_logs([r'serving grpc on',
73 r'plugin-clnrest: REST server running at ' + base_url])
74 ca_cert = Path(l1.daemon.lightning_dir) / TEST_NETWORK / 'ca.pem'
75 http_session = http_session_with_retry()
76 response = http_session.get(base_url + '/v1/list-methods', verify=ca_cert)
77 assert response.status_code == 200
78
79
80def test_generate_certificate(node_factory):

Callers

nothing calls this directly

Calls 5

http_session_with_retryFunction · 0.85
get_unused_portMethod · 0.80
wait_for_logsMethod · 0.80
get_nodeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected