also use openssl envvars to find certs on windows (closes #22449)

Patch by Christian Heimes and Alex Gaynor.
This commit is contained in:
Benjamin Peterson 2014-10-03 17:27:05 -04:00
parent 7280561b5b
commit 5915b0f924
3 changed files with 12 additions and 2 deletions

View file

@ -1016,6 +1016,14 @@ class ContextTests(unittest.TestCase):
self.assertRaises(TypeError, ctx.load_default_certs, None)
self.assertRaises(TypeError, ctx.load_default_certs, 'SERVER_AUTH')
def test_load_default_certs_env(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
with support.EnvironmentVarGuard() as env:
env["SSL_CERT_DIR"] = CAPATH
env["SSL_CERT_FILE"] = CERTFILE
ctx.load_default_certs()
self.assertEqual(ctx.cert_store_stats(), {"crl": 0, "x509": 1, "x509_ca": 0})
def test_create_default_context(self):
ctx = ssl.create_default_context()
self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)