MCPcopy
hub / github.com/urllib3/urllib3 / test_assert_hostname_closes_socket

Method test_assert_hostname_closes_socket

test/test_connection.py:259–271  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

257 context.wrap_socket.return_value.close.assert_called_once_with()
258
259 def test_assert_hostname_closes_socket(self) -> None:
260 context = mock.create_autospec(ssl_.SSLContext)
261 context.wrap_socket.return_value.getpeercert.return_value = {
262 "subjectAltName": (("DNS", "google.com"),)
263 }
264 conn = HTTPSConnection(
265 "google.com", port=443, assert_hostname="example.com", ssl_context=context
266 )
267 with mock.patch.object(conn, "_new_conn"):
268 with pytest.raises(ImplementationCertificateError):
269 conn.connect()
270
271 context.wrap_socket.return_value.close.assert_called_once_with()
272
273 @pytest.mark.parametrize(
274 "accept_encoding",

Callers

nothing calls this directly

Calls 2

connectMethod · 0.95
HTTPSConnectionClass · 0.90

Tested by

no test coverage detected