MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_networked_bad_cert

Method test_networked_bad_cert

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

requiresMethod · 0.80
load_verify_locationsMethod · 0.45
assertRaisesMethod · 0.45
requestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected