(self)
| 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) |
nothing calls this directly
no test coverage detected