MCPcopy
hub / github.com/urllib3/urllib3 / test_debuglevel

Method test_debuglevel

test/with_dummyserver/test_socketlevel.py:1490–1505  ·  view source on GitHub ↗
(self, capsys: pytest.CaptureFixture[str])

Source from the content-addressed store, hash-verified

1488 )
1489
1490 def test_debuglevel(self, capsys: pytest.CaptureFixture[str]) -> None:
1491 def http_socket_handler(listener: socket.socket) -> None:
1492 sock = listener.accept()[0]
1493 consume_socket(sock)
1494 sock.send(b"HTTP/1.0 200 OK\r\nExample-Header: Example-Value\r\n\r\n")
1495 sock.close()
1496
1497 self._start_server(http_socket_handler)
1498 base_url = f"http://{self.host}:{self.port}"
1499
1500 with mock.patch("http.client.HTTPConnection.debuglevel", 1):
1501 with ProxyManager(base_url) as proxy:
1502 with pytest.raises(MaxRetryError):
1503 proxy.request("GET", "https://example.com", retries=0)
1504
1505 assert "header: Example-Header: Example-Value\r\n\n" in capsys.readouterr().out
1506
1507
1508class TestSSL(SocketDummyServerTestCase):

Callers

nothing calls this directly

Calls 3

ProxyManagerClass · 0.90
_start_serverMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected