diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-10-03 22:17:15 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-10-03 22:17:15 (GMT) |
commit | 91244e01bbe0dcd1a1183ad4e80cd6cb33b553de (patch) | |
tree | ed9022fcc568a91093caacc414b1b62312a04278 /Lib/test | |
parent | 5915b0f924152b4801c1fe49aff348fd1981cc05 (diff) | |
download | cpython-91244e01bbe0dcd1a1183ad4e80cd6cb33b553de.zip cpython-91244e01bbe0dcd1a1183ad4e80cd6cb33b553de.tar.gz cpython-91244e01bbe0dcd1a1183ad4e80cd6cb33b553de.tar.bz2 |
separate cert loading tests into Windows and non-Windows cases
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_ssl.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index c2a4f0e..e71a400 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1016,6 +1016,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: @@ -1024,6 +1025,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) |