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

Function test_unknown_method

tests/test_clnrest.py:166–182  ·  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

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