MCPcopy Index your code
hub / github.com/python/cpython / test_local_unknown_cert

Method test_local_unknown_cert

Lib/test/test_httplib.py:2148–2155  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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
2150 import ssl
2151 server = self.make_server(CERT_localhost)
2152 h = client.HTTPSConnection('localhost', server.port)
2153 with self.assertRaises(ssl.SSLError) as exc_info:
2154 h.request('GET', '/')
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

Callers

nothing calls this directly

Calls 4

make_serverMethod · 0.95
assertRaisesMethod · 0.45
requestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected