summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-12-12 11:23:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-12-12 11:23:59 (GMT)
commit648b862017d842fe31da6b14b6ccec9853138709 (patch)
treeec7ec0482972da7c8775e8c17d64cf933fa5fdad /Lib/test/test_ssl.py
parent0ae406377386a7e18ef64ac6d0745027de696f4c (diff)
downloadcpython-648b862017d842fe31da6b14b6ccec9853138709.zip
cpython-648b862017d842fe31da6b14b6ccec9853138709.tar.gz
cpython-648b862017d842fe31da6b14b6ccec9853138709.tar.bz2
Issue #22935: Fix test_ssl when the SSLv3 protocol is not supported
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 67eea98..7362bac 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -143,8 +143,8 @@ class BasicSocketTests(unittest.TestCase):
def test_str_for_enums(self):
# Make sure that the PROTOCOL_* constants have enum-like string
# reprs.
- proto = ssl.PROTOCOL_SSLv3
- self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_SSLv3')
+ proto = ssl.PROTOCOL_SSLv23
+ self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_SSLv23')
ctx = ssl.SSLContext(proto)
self.assertIs(ctx.protocol, proto)
@@ -2384,7 +2384,8 @@ else:
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL)
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED)
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False)
- try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
+ if hasattr(ssl, 'PROTOCOL_SSLv3'):
+ try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False)
# SSLv23 client with specific SSL options
if no_sslv2_implies_sslv3_hello():