(self)
| 3311 | ssl.HAS_NEVER_CHECK_COMMON_NAME, "test requires hostname_checks_common_name" |
| 3312 | ) |
| 3313 | def test_hostname_checks_common_name(self): |
| 3314 | client_context, server_context, hostname = testing_context() |
| 3315 | assert client_context.hostname_checks_common_name |
| 3316 | client_context.hostname_checks_common_name = False |
| 3317 | |
| 3318 | # default cert has a SAN |
| 3319 | server = ThreadedEchoServer(context=server_context, chatty=True) |
| 3320 | with server: |
| 3321 | with client_context.wrap_socket(socket.socket(), |
| 3322 | server_hostname=hostname) as s: |
| 3323 | s.connect((HOST, server.port)) |
| 3324 | |
| 3325 | client_context, server_context, hostname = testing_context(NOSANFILE) |
| 3326 | client_context.hostname_checks_common_name = False |
| 3327 | server = ThreadedEchoServer(context=server_context, chatty=True) |
| 3328 | with server: |
| 3329 | with client_context.wrap_socket(socket.socket(), |
| 3330 | server_hostname=hostname) as s: |
| 3331 | with self.assertRaises(ssl.SSLCertVerificationError): |
| 3332 | s.connect((HOST, server.port)) |
| 3333 | |
| 3334 | def test_ecc_cert(self): |
| 3335 | client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
nothing calls this directly
no test coverage detected