(self)
| 2155 | self.assertEqual(exc_info.exception.reason, 'CERTIFICATE_VERIFY_FAILED') |
| 2156 | |
| 2157 | def test_local_good_hostname(self): |
| 2158 | # The (valid) cert validates the HTTPS hostname |
| 2159 | import ssl |
| 2160 | server = self.make_server(CERT_localhost) |
| 2161 | context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 2162 | context.load_verify_locations(CERT_localhost) |
| 2163 | h = client.HTTPSConnection('localhost', server.port, context=context) |
| 2164 | self.addCleanup(h.close) |
| 2165 | h.request('GET', '/nonexistent') |
| 2166 | resp = h.getresponse() |
| 2167 | self.addCleanup(resp.close) |
| 2168 | self.assertEqual(resp.status, 404) |
| 2169 | |
| 2170 | def test_local_bad_hostname(self): |
| 2171 | # The (valid) cert doesn't validate the HTTPS hostname |
nothing calls this directly
no test coverage detected