summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-01-04 00:44:47 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-01-04 00:44:47 +0100
commit4b411bf616ef943f1163e59706ee90524a93bded (patch)
tree4ca77e9bf44f1298b9d5e2f5f6087440278df27e
parent527eb5d40215ef6f2fa9e97afcff740e96f456f5 (diff)
downloadtrollius-4b411bf616ef943f1163e59706ee90524a93bded.tar.gz
Fix SSL tests: backported SSLContext has no options
-rw-r--r--tests/test_events.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_events.py b/tests/test_events.py
index 71a747a..cc5f3cb 100644
--- a/tests/test_events.py
+++ b/tests/test_events.py
@@ -608,7 +608,8 @@ class EventLoopTestsMixin(object):
def _make_ssl_server(self, factory, certfile, keyfile=None):
sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- sslcontext.options |= ssl.OP_NO_SSLv2
+ if hasattr(sslcontext, 'options'):
+ sslcontext.options |= ssl.OP_NO_SSLv2
sslcontext.load_cert_chain(certfile, keyfile)
f = self.loop.create_server(
@@ -678,7 +679,8 @@ class EventLoopTestsMixin(object):
server, host, port = self._make_ssl_server(factory, SIGNED_CERTFILE)
sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- sslcontext_client.options |= ssl.OP_NO_SSLv2
+ if hasattr(sslcontext, 'options'):
+ sslcontext_client.options |= ssl.OP_NO_SSLv2
sslcontext_client.verify_mode = ssl.CERT_REQUIRED
if hasattr(sslcontext_client, 'check_hostname'):
sslcontext_client.check_hostname = True
@@ -706,7 +708,8 @@ class EventLoopTestsMixin(object):
server, host, port = self._make_ssl_server(factory, SIGNED_CERTFILE)
sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- sslcontext_client.options |= ssl.OP_NO_SSLv2
+ if hasattr(sslcontext, 'options'):
+ sslcontext_client.options |= ssl.OP_NO_SSLv2
sslcontext_client.verify_mode = ssl.CERT_REQUIRED
sslcontext_client.load_verify_locations(
cafile=SIGNING_CA)
@@ -737,7 +740,8 @@ class EventLoopTestsMixin(object):
server, host, port = self._make_ssl_server(factory, SIGNED_CERTFILE)
sslcontext_client = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- sslcontext_client.options |= ssl.OP_NO_SSLv2
+ if hasattr(sslcontext, 'options'):
+ sslcontext_client.options |= ssl.OP_NO_SSLv2
sslcontext_client.verify_mode = ssl.CERT_REQUIRED
sslcontext_client.load_verify_locations(cafile=SIGNING_CA)
if hasattr(sslcontext_client, 'check_hostname'):