Commit 2b713eab authored by Romain Courteaud's avatar Romain Courteaud

[officejs_test] Allow to access HTTPS urls

parent 86a6f168
...@@ -5,6 +5,7 @@ from StringIO import StringIO ...@@ -5,6 +5,7 @@ from StringIO import StringIO
import zipfile import zipfile
import httplib import httplib
import urlparse import urlparse
import ssl
class LocalStringIO(StringIO): class LocalStringIO(StringIO):
...@@ -116,7 +117,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin): ...@@ -116,7 +117,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin):
api_scheme, api_netloc, api_path, api_query, \ api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url()) api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc) if (api_scheme == 'https'):
connection = httplib.HTTPSConnection(api_netloc, context=ssl._create_unverified_context(), timeout=10)
else:
connection = httplib.HTTPConnection(api_netloc, timeout=10)
connection.request( connection.request(
method='GET', method='GET',
...@@ -230,7 +234,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin): ...@@ -230,7 +234,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin):
api_scheme, api_netloc, api_path, api_query, \ api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url()) api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc) if (api_scheme == 'https'):
connection = httplib.HTTPSConnection(api_netloc, context=ssl._create_unverified_context(), timeout=10)
else:
connection = httplib.HTTPConnection(api_netloc, timeout=10)
connection.request( connection.request(
method='GET', method='GET',
......
...@@ -45,7 +45,11 @@ ...@@ -45,7 +45,11 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple/> <tuple>
<string>W:117, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W:117, 38: Unused variable \'api_query\' (unused-variable)</string>
<string>W:118, 6: Unused variable \'api_fragment\' (unused-variable)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -5,6 +5,7 @@ from StringIO import StringIO ...@@ -5,6 +5,7 @@ from StringIO import StringIO
import zipfile import zipfile
import httplib import httplib
import urlparse import urlparse
import ssl
class LocalStringIO(StringIO): class LocalStringIO(StringIO):
...@@ -105,7 +106,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin): ...@@ -105,7 +106,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin):
api_scheme, api_netloc, api_path, api_query, \ api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url()) api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc) if (api_scheme == 'https'):
connection = httplib.HTTPSConnection(api_netloc, context=ssl._create_unverified_context(), timeout=10)
else:
connection = httplib.HTTPConnection(api_netloc, timeout=10)
connection.request( connection.request(
method='GET', method='GET',
...@@ -219,7 +223,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin): ...@@ -219,7 +223,10 @@ class TestOfficeJSScenario(testOfficeJSAppstoreMixin):
api_scheme, api_netloc, api_path, api_query, \ api_scheme, api_netloc, api_path, api_query, \
api_fragment = urlparse.urlsplit(self.portal.absolute_url()) api_fragment = urlparse.urlsplit(self.portal.absolute_url())
connection = httplib.HTTPConnection(api_netloc) if (api_scheme == 'https'):
connection = httplib.HTTPSConnection(api_netloc, context=ssl._create_unverified_context(), timeout=10)
else:
connection = httplib.HTTPConnection(api_netloc, timeout=10)
connection.request( connection.request(
method='GET', method='GET',
......
...@@ -46,10 +46,9 @@ ...@@ -46,10 +46,9 @@
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple>
<string>W:105, 28: Unused variable \'api_path\' (unused-variable)</string> <string>W:106, 28: Unused variable \'api_path\' (unused-variable)</string>
<string>W:105, 38: Unused variable \'api_query\' (unused-variable)</string> <string>W:106, 38: Unused variable \'api_query\' (unused-variable)</string>
<string>W:105, 4: Unused variable \'api_scheme\' (unused-variable)</string> <string>W:107, 6: Unused variable \'api_fragment\' (unused-variable)</string>
<string>W:106, 6: Unused variable \'api_fragment\' (unused-variable)</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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