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,8 +44,10 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -44,8 +44,10 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
# Specify svn.erp5.org certificate file. # Specify svn.erp5.org certificate file.
import ssl import ssl
_create_default_https_context_orig = ssl._create_default_https_context if hasattr(ssl, '_create_default_https_context'):
def _create_default_https_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=None, # 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): capath=None, cadata=None):
return _create_default_https_context_orig( return _create_default_https_context_orig(
purpose, purpose,
...@@ -53,7 +55,7 @@ def _create_default_https_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=None, ...@@ -53,7 +55,7 @@ def _create_default_https_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=None,
capath=capath, capath=capath,
cadata=cadata, cadata=cadata,
) )
ssl._create_default_https_context = _create_default_https_context ssl._create_default_https_context = _create_default_https_context
class TestTemplateTool(ERP5TypeTestCase): class TestTemplateTool(ERP5TypeTestCase):
"""Test the template tool """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