(self)
| 492 | ssl_support.HAVE_WINCERTSTORE = have_wincertstore |
| 493 | |
| 494 | def test_certifi_support(self): |
| 495 | if hasattr(ssl, "SSLContext"): |
| 496 | # SSLSocket doesn't provide ca_certs attribute on pythons |
| 497 | # with SSLContext and SSLContext provides no information |
| 498 | # about ca_certs. |
| 499 | raise SkipTest("Can't test when SSLContext available.") |
| 500 | if not ssl_support.HAVE_CERTIFI: |
| 501 | raise SkipTest("Need certifi to test certifi support.") |
| 502 | |
| 503 | have_wincertstore = ssl_support.HAVE_WINCERTSTORE |
| 504 | # Force the test on Windows, regardless of environment. |
| 505 | ssl_support.HAVE_WINCERTSTORE = False |
| 506 | try: |
| 507 | ctx = get_ssl_context(None, None, CA_PEM, None, False, False, False, _IS_SYNC) |
| 508 | ssl_sock = ctx.wrap_socket(socket.socket()) |
| 509 | self.assertEqual(ssl_sock.ca_certs, CA_PEM) |
| 510 | |
| 511 | ctx = get_ssl_context(None, None, None, None, False, False, False, _IS_SYNC) |
| 512 | ssl_sock = ctx.wrap_socket(socket.socket()) |
| 513 | self.assertEqual(ssl_sock.ca_certs, ssl_support.certifi.where()) |
| 514 | finally: |
| 515 | ssl_support.HAVE_WINCERTSTORE = have_wincertstore |
| 516 | |
| 517 | def test_wincertstore(self): |
| 518 | if sys.platform != "win32": |
nothing calls this directly
no test coverage detected