MCPcopy
hub / github.com/urllib3/urllib3 / test_wrong_sni_hint

Method test_wrong_sni_hint

test/test_ssltransport.py:410–426  ·  view source on GitHub ↗

Provides a wrong sni hint to validate an exception is thrown.

(self)

Source from the content-addressed store, hash-verified

408
409 @pytest.mark.timeout(PER_TEST_TIMEOUT)
410 def test_wrong_sni_hint(self) -> None:
411 """
412 Provides a wrong sni hint to validate an exception is thrown.
413 """
414 self.start_destination_server()
415 self.start_proxy_server()
416
417 sock = socket.create_connection(
418 (self.proxy_server.host, self.proxy_server.port)
419 )
420 with self.client_context.wrap_socket(
421 sock, server_hostname="localhost"
422 ) as proxy_sock:
423 with pytest.raises(ssl.SSLCertVerificationError):
424 SSLTransport(
425 proxy_sock, self.client_context, server_hostname="veryverywrong"
426 )
427
428 @pytest.mark.timeout(PER_TEST_TIMEOUT)
429 @pytest.mark.parametrize("buffering", [None, 0])

Callers

nothing calls this directly

Calls 4

start_proxy_serverMethod · 0.95
SSLTransportClass · 0.90
wrap_socketMethod · 0.80

Tested by

no test coverage detected