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

Function test_unknown_method

tests/test_clnrest.py:168–184  ·  view source on GitHub ↗

Test GET request error on `/v1/unknown-get` end point with default values for options.

(node_factory)

Source from the content-addressed store, hash-verified

166
167
168def test_unknown_method(node_factory):
169 """Test GET request error on `/v1/unknown-get` end point with default values for options."""
170 # start a node with clnrest
171 l1, base_url, ca_cert = start_node_with_clnrest(node_factory)
172 http_session = http_session_with_retry()
173
174 rune = l1.rpc.createrune()['rune']
175 response = http_session.get(base_url + '/v1/unknown-get', headers={'Rune': rune}, verify=ca_cert)
176 assert response.status_code == 405
177 assert response.json()['code'] == -32601
178 assert response.json()['message'] == "Path invalid, http_method must be POST for CLN methods"
179
180 """Test POST request error on `/v1/unknown-post` end point."""
181 response = http_session.post(base_url + '/v1/unknown-post', headers={'Rune': rune}, verify=ca_cert)
182 assert response.status_code == 404
183 assert response.json()['code'] == -32601
184 assert response.json()['message'] == "Unknown command 'unknown-post'"
185
186
187def test_rpc_method(node_factory):

Callers

nothing calls this directly

Calls 4

start_node_with_clnrestFunction · 0.85
http_session_with_retryFunction · 0.85
jsonMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected