summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-10-03 22:17:15 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-10-03 22:17:15 (GMT)
commita02ae2500a7f7adcccd55b7de206908ec109640f (patch)
tree19014525f0f3eecc1955791e0047fed40582bad1 /Lib/test/test_ssl.py
parent0b30a2bd27e4bb4de9606a873d69dc8063bca58c (diff)
downloadcpython-a02ae2500a7f7adcccd55b7de206908ec109640f.zip
cpython-a02ae2500a7f7adcccd55b7de206908ec109640f.tar.gz
cpython-a02ae2500a7f7adcccd55b7de206908ec109640f.tar.bz2
separate cert loading tests into Windows and non-Windows cases
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 1f0e093..825b986 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -1058,6 +1058,7 @@ class ContextTests(unittest.TestCase):
self.assertRaises(TypeError, ctx.load_default_certs, None)
self.assertRaises(TypeError, ctx.load_default_certs, 'SERVER_AUTH')
+ @unittest.skipIf(sys.platform == "win32", "not-Windows specific")
def test_load_default_certs_env(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
with support.EnvironmentVarGuard() as env:
@@ -1066,6 +1067,20 @@ class ContextTests(unittest.TestCase):
ctx.load_default_certs()
self.assertEqual(ctx.cert_store_stats(), {"crl": 0, "x509": 1, "x509_ca": 0})
+ @unittest.skipUnless(sys.platform == "win32", "Windows specific")
+ def test_load_default_certs_env_windows(self):
+ ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+ ctx.load_default_certs()
+ stats = ctx.cert_store_stats()
+
+ 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()
+ stats["x509"] += 1
+ self.assertEqual(ctx.cert_store_stats(), stats)
+
def test_create_default_context(self):
ctx = ssl.create_default_context()
self.assertEqual(ctx.protocol, ssl.PROTOCOL_SSLv23)