Commit 7dbee586 authored by Jérome Perrin's avatar Jérome Perrin

testTemplateTool: support python < 2.7.9 when patching ssl to accept certificate

This is fuxip for 1038d441
parent 666709fb
......@@ -44,16 +44,18 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
# Specify svn.erp5.org certificate file.
import ssl
_create_default_https_context_orig = ssl._create_default_https_context
def _create_default_https_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=None,
capath=None, cadata=None):
return _create_default_https_context_orig(
purpose,
cafile=os.path.join(os.path.dirname(__file__), 'svn.erp5.org.cert'),
capath=capath,
cadata=cadata,
)
ssl._create_default_https_context = _create_default_https_context
if hasattr(ssl, '_create_default_https_context'):
# On python >= 2.7.9 we patch ssl module to accept our svn.erp5.org certificate
_create_default_https_context_orig = ssl._create_default_https_context
def _create_default_https_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=None,
capath=None, cadata=None):
return _create_default_https_context_orig(
purpose,
cafile=os.path.join(os.path.dirname(__file__), 'svn.erp5.org.cert'),
capath=capath,
cadata=cadata,
)
ssl._create_default_https_context = _create_default_https_context
class TestTemplateTool(ERP5TypeTestCase):
"""Test the template tool
......
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