(self)
| 2155 | self.assertTrue(cert) |
| 2156 | |
| 2157 | def test_connect_with_context_fail(self): |
| 2158 | # This should fail because we have no verification certs. Connection |
| 2159 | # failure crashes ThreadedEchoServer, so run this in an independent |
| 2160 | # test method. |
| 2161 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 2162 | s = ctx.wrap_socket( |
| 2163 | socket.socket(socket.AF_INET), |
| 2164 | server_hostname=SIGNED_CERTFILE_HOSTNAME |
| 2165 | ) |
| 2166 | self.addCleanup(s.close) |
| 2167 | # Allow for flexible libssl error messages. |
| 2168 | regex = re.compile(r"""( |
| 2169 | certificate verify failed # OpenSSL |
| 2170 | | |
| 2171 | CERTIFICATE_VERIFY_FAILED # AWS-LC |
| 2172 | )""", re.X) |
| 2173 | self.assertRaisesRegex(ssl.SSLError, regex, |
| 2174 | s.connect, self.server_addr) |
| 2175 | |
| 2176 | def test_connect_capath(self): |
| 2177 | # Verify server certificates using the `capath` argument |
nothing calls this directly
no test coverage detected