From 91244e01bbe0dcd1a1183ad4e80cd6cb33b553de Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 3 Oct 2014 18:17:15 -0400 Subject: [PATCH] separate cert loading tests into Windows and non-Windows cases --- Lib/test/test_ssl.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index c2a4f0e8111..e71a4001601 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1016,6 +1016,7 @@ def test_load_default_certs(self): 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: @@ -1024,6 +1025,20 @@ def test_load_default_certs_env(self): 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)