(self)
| 2134 | |
| 2135 | @support.requires_resource('walltime') |
| 2136 | def test_networked_bad_cert(self): |
| 2137 | # We feed a "CA" cert that is unrelated to the server's cert |
| 2138 | import ssl |
| 2139 | support.requires('network') |
| 2140 | with socket_helper.transient_internet('self-signed.pythontest.net'): |
| 2141 | context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 2142 | context.load_verify_locations(CERT_localhost) |
| 2143 | h = client.HTTPSConnection('self-signed.pythontest.net', 443, context=context) |
| 2144 | with self.assertRaises(ssl.SSLError) as exc_info: |
| 2145 | h.request('GET', '/') |
| 2146 | self.assertEqual(exc_info.exception.reason, 'CERTIFICATE_VERIFY_FAILED') |
| 2147 | |
| 2148 | def test_local_unknown_cert(self): |
| 2149 | # The custom cert isn't known to the default trust bundle |
nothing calls this directly
no test coverage detected