slaprunner resiliency test suite: compatibility with python 2.7.9.

Python 2.7.9 enabled SSL certificate verification by default (PEP476).
This commit disables certificate verification by creating
a non-verifying SSL context.
parent 1b38e187
...@@ -33,6 +33,7 @@ import cookielib ...@@ -33,6 +33,7 @@ import cookielib
import json import json
from lxml import etree from lxml import etree
import random import random
import ssl
import string import string
import time import time
import urllib2 import urllib2
...@@ -48,8 +49,11 @@ class SlaprunnerTestSuite(ResiliencyTestSuite): ...@@ -48,8 +49,11 @@ class SlaprunnerTestSuite(ResiliencyTestSuite):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
# Setup urllib2 with cookie support # Setup urllib2 with cookie support
cookie_jar = cookielib.CookieJar() cookie_jar = cookielib.CookieJar()
ssl_context = ssl._create_unverified_context()
self._opener_director = urllib2.build_opener( self._opener_director = urllib2.build_opener(
urllib2.HTTPCookieProcessor(cookie_jar) urllib2.HTTPCookieProcessor(cookie_jar),
urllib2.HTTPSHandler(context=ssl_context)
) )
ResiliencyTestSuite.__init__(self, *args, **kwargs) ResiliencyTestSuite.__init__(self, *args, **kwargs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment