Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 648b862

Browse files
committed
Issue #22935: Fix test_ssl when the SSLv3 protocol is not supported
1 parent 0ae4063 commit 648b862

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

Lib/test/test_ssl.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ def test_constants(self):
143143
def test_str_for_enums(self):
144144
# Make sure that the PROTOCOL_* constants have enum-like string
145145
# reprs.
146-
proto = ssl.PROTOCOL_SSLv3
147-
self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_SSLv3')
146+
proto = ssl.PROTOCOL_SSLv23
147+
self.assertEqual(str(proto), '_SSLMethod.PROTOCOL_SSLv23')
148148
ctx = ssl.SSLContext(proto)
149149
self.assertIs(ctx.protocol, proto)
150150

@@ -2384,7 +2384,8 @@ def test_protocol_sslv2(self):
23842384
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_OPTIONAL)
23852385
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv2, True, ssl.CERT_REQUIRED)
23862386
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv23, False)
2387-
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
2387+
if hasattr(ssl, 'PROTOCOL_SSLv3'):
2388+
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_SSLv3, False)
23882389
try_protocol_combo(ssl.PROTOCOL_SSLv2, ssl.PROTOCOL_TLSv1, False)
23892390
# SSLv23 client with specific SSL options
23902391
if no_sslv2_implies_sslv3_hello():

0 commit comments

Comments
 (0)