(self)
| 2088 | |
| 2089 | @support.requires_resource('walltime') |
| 2090 | def test_networked_bad_cert(self): |
| 2091 | # We feed a "CA" cert that is unrelated to the server's cert |
| 2092 | import ssl |
| 2093 | support.requires('network') |
| 2094 | with socket_helper.transient_internet('self-signed.pythontest.net'): |
| 2095 | context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 2096 | context.load_verify_locations(CERT_localhost) |
| 2097 | h = client.HTTPSConnection('self-signed.pythontest.net', 443, context=context) |
| 2098 | with self.assertRaises(ssl.SSLError) as exc_info: |
| 2099 | h.request('GET', '/') |
| 2100 | self.assertEqual(exc_info.exception.reason, 'CERTIFICATE_VERIFY_FAILED') |
| 2101 | |
| 2102 | def test_local_unknown_cert(self): |
| 2103 | # The custom cert isn't known to the default trust bundle |
nothing calls this directly
no test coverage detected