MCPcopy
hub / github.com/urllib3/urllib3 / test_bad_method

Function test_bad_method

test/contrib/emscripten/test_emscripten.py:158–175  ·  view source on GitHub ↗
(
    selenium_coverage: typing.Any, testserver_http: PyodideServerInfo
)

Source from the content-addressed store, hash-verified

156
157# wrong protocol / protocol error etc. should raise an exception of http.client.HTTPException
158def test_bad_method(
159 selenium_coverage: typing.Any, testserver_http: PyodideServerInfo
160) -> None:
161 @run_in_pyodide # type: ignore[untyped-decorator]
162 def pyodide_test(selenium_coverage, host: str, port: int) -> None: # type: ignore[no-untyped-def]
163 import http.client
164
165 import pytest
166
167 from urllib3.connection import HTTPConnection
168
169 conn = HTTPConnection(host, port)
170 with pytest.raises(http.client.HTTPException):
171 conn.request("TRACE", f"http://{host}:{port}/")
172
173 pyodide_test(
174 selenium_coverage, testserver_http.http_host, testserver_http.https_port
175 )
176
177
178# no connection - should raise

Callers

nothing calls this directly

Calls 1

pyodide_testFunction · 0.85

Tested by

no test coverage detected