MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_hostname_checks_common_name

Method test_hostname_checks_common_name

Lib/test/test_ssl.py:3030–3049  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3028 ssl.HAS_NEVER_CHECK_COMMON_NAME, "test requires hostname_checks_common_name"
3029 )
3030 def test_hostname_checks_common_name(self):
3031 client_context, server_context, hostname = testing_context()
3032 assert client_context.hostname_checks_common_name
3033 client_context.hostname_checks_common_name = False
3034
3035 # default cert has a SAN
3036 server = ThreadedEchoServer(context=server_context, chatty=True)
3037 with server:
3038 with client_context.wrap_socket(socket.socket(),
3039 server_hostname=hostname) as s:
3040 s.connect((HOST, server.port))
3041
3042 client_context, server_context, hostname = testing_context(NOSANFILE)
3043 client_context.hostname_checks_common_name = False
3044 server = ThreadedEchoServer(context=server_context, chatty=True)
3045 with server:
3046 with client_context.wrap_socket(socket.socket(),
3047 server_hostname=hostname) as s:
3048 with self.assertRaises(ssl.SSLCertVerificationError):
3049 s.connect((HOST, server.port))
3050
3051 def test_ecc_cert(self):
3052 client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)

Callers

nothing calls this directly

Calls 6

testing_contextFunction · 0.85
ThreadedEchoServerClass · 0.85
wrap_socketMethod · 0.80
socketMethod · 0.80
connectMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected