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

Method test_ssl_verified

Lib/test/test_imaplib.py:1104–1123  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1102
1103 @threading_helper.reap_threads
1104 def test_ssl_verified(self):
1105 ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
1106 ssl_context.load_verify_locations(CAFILE)
1107
1108 # Allow for flexible libssl error messages.
1109 regex = re.compile(r"""(
1110 IP address mismatch, certificate is not valid for '127.0.0.1' # OpenSSL
1111 |
1112 CERTIFICATE_VERIFY_FAILED # AWS-LC
1113 )""", re.X)
1114 with self.assertRaisesRegex(ssl.CertificateError, regex):
1115 with self.reaped_server(SimpleIMAPHandler) as server:
1116 client = self.imap_class(*server.server_address,
1117 ssl_context=ssl_context)
1118 client.shutdown()
1119
1120 with self.reaped_server(SimpleIMAPHandler) as server:
1121 client = self.imap_class("localhost", server.server_address[1],
1122 ssl_context=ssl_context)
1123 client.shutdown()
1124
1125
1126class TestModule(unittest.TestCase):

Callers

nothing calls this directly

Calls 4

assertRaisesRegexMethod · 0.80
reaped_serverMethod · 0.80
compileMethod · 0.45
shutdownMethod · 0.45

Tested by

no test coverage detected