WIP: Why?
... | @@ -56,6 +56,7 @@ class TestXForwardedFor(ERP5TypeTestCase): | ... | @@ -56,6 +56,7 @@ class TestXForwardedFor(ERP5TypeTestCase): |
response = requests.get( | response = requests.get( | ||
'%s/%s' % (self.portal.absolute_url(), script_id), | '%s/%s' % (self.portal.absolute_url(), script_id), | ||
headers={'X-Forwarded-For': '1.2.3.4'}, | headers={'X-Forwarded-For': '1.2.3.4'}, | ||
timeout=5, | |||
|
|||
) | ) | ||
self.assertNotEqual(response.text, '1.2.3.4') | self.assertNotEqual(response.text, '1.2.3.4') | ||
last_line = get_Z2_log_last_line() | last_line = get_Z2_log_last_line() | ||
... | @@ -63,6 +64,7 @@ class TestXForwardedFor(ERP5TypeTestCase): | ... | @@ -63,6 +64,7 @@ class TestXForwardedFor(ERP5TypeTestCase): |
response = requests.get( | response = requests.get( | ||
'%s/%s' % (self.portal.absolute_url(), script_id), | '%s/%s' % (self.portal.absolute_url(), script_id), | ||
headers={'X-Forwarded-For': '1.2.3.4, 5.6.7.8'}, | headers={'X-Forwarded-For': '1.2.3.4, 5.6.7.8'}, | ||
timeout=5, | |||
) | ) | ||
self.assertNotEqual(response.text, '1.2.3.4') | self.assertNotEqual(response.text, '1.2.3.4') | ||
self.assertNotEqual(response.text, '5.6.7.8') | self.assertNotEqual(response.text, '5.6.7.8') | ||
... | @@ -71,6 +73,7 @@ class TestXForwardedFor(ERP5TypeTestCase): | ... | @@ -71,6 +73,7 @@ class TestXForwardedFor(ERP5TypeTestCase): |
self.assertFalse(last_line.startswith('5.6.7.8 - '), last_line) | self.assertFalse(last_line.startswith('5.6.7.8 - '), last_line) | ||
response = requests.get( | response = requests.get( | ||
'%s/%s' % (self.portal.absolute_url(), script_id), | '%s/%s' % (self.portal.absolute_url(), script_id), | ||
timeout=5, | |||
) | ) | ||
self.assertNotEqual(response.text, '1.2.3.4') | self.assertNotEqual(response.text, '1.2.3.4') | ||
last_line = get_Z2_log_last_line() | last_line = get_Z2_log_last_line() | ||
... | @@ -81,6 +84,7 @@ class TestXForwardedFor(ERP5TypeTestCase): | ... | @@ -81,6 +84,7 @@ class TestXForwardedFor(ERP5TypeTestCase): |
response = requests.get( | response = requests.get( | ||
'%s/%s' % (self.portal.absolute_url(), script_id), | '%s/%s' % (self.portal.absolute_url(), script_id), | ||
headers={'X-Forwarded-For': '1.2.3.4'}, | headers={'X-Forwarded-For': '1.2.3.4'}, | ||
timeout=5, | |||
) | ) | ||
self.assertEqual(response.text, '1.2.3.4') | self.assertEqual(response.text, '1.2.3.4') | ||
last_line = get_Z2_log_last_line() | last_line = get_Z2_log_last_line() | ||
... | @@ -88,12 +92,14 @@ class TestXForwardedFor(ERP5TypeTestCase): | ... | @@ -88,12 +92,14 @@ class TestXForwardedFor(ERP5TypeTestCase): |
response = requests.get( | response = requests.get( | ||
'%s/%s' % (self.portal.absolute_url(), script_id), | '%s/%s' % (self.portal.absolute_url(), script_id), | ||
headers={'X-Forwarded-For': '1.2.3.4, 5.6.7.8'}, | headers={'X-Forwarded-For': '1.2.3.4, 5.6.7.8'}, | ||
timeout=5, | |||
) | ) | ||
self.assertEqual(response.text, '1.2.3.4') | self.assertEqual(response.text, '1.2.3.4') | ||
last_line = get_Z2_log_last_line() | last_line = get_Z2_log_last_line() | ||
self.assertTrue(last_line.startswith('1.2.3.4 - '), last_line) | self.assertTrue(last_line.startswith('1.2.3.4 - '), last_line) | ||
response = requests.get( | response = requests.get( | ||
'%s/%s' % (self.portal.absolute_url(), script_id), | '%s/%s' % (self.portal.absolute_url(), script_id), | ||
timeout=5, | |||
) | ) | ||
self.assertNotEqual(response.text, '1.2.3.4') | self.assertNotEqual(response.text, '1.2.3.4') | ||
last_line = get_Z2_log_last_line() | last_line = get_Z2_log_last_line() | ||
... | ... |
... | @@ -84,11 +84,12 @@ class TestWebDavSupport(ERP5TypeTestCase): | ... | @@ -84,11 +84,12 @@ class TestWebDavSupport(ERP5TypeTestCase): |
person = self.portal.person_module.newContent() | person = self.portal.person_module.newContent() | ||
self.tic() | self.tic() | ||
file_object = self.makeFileUpload('images/erp5_logo.png') | file_object = self.makeFileUpload('images/erp5_logo.png') | ||
response = self.publish(person.getPath() + '/erp5_logo.png', | response = self.publish( | ||
request_method='PUT', | person.getPath() + '/erp5_logo.png', | ||
stdin=file_object, | request_method='PUT', | ||
basic=self.authentication) | stdin=file_object, | ||
self.assertEqual(response.getStatus(), httplib.CREATED) | env={"CONTENT_TYPE": 'image/png'}, | ||
|
|||
basic=self.authentication) | |||
self.assertEqual(response.getStatus(), six.moves.http_client.CREATED) | self.assertEqual(response.getStatus(), six.moves.http_client.CREATED) | ||
image = person['erp5_logo.png'] | image = person['erp5_logo.png'] | ||
self.assertEqual(image.getPortalType(), 'Embedded File') | self.assertEqual(image.getPortalType(), 'Embedded File') | ||
... | @@ -104,10 +105,12 @@ class TestWebDavSupport(ERP5TypeTestCase): | ... | @@ -104,10 +105,12 @@ class TestWebDavSupport(ERP5TypeTestCase): |
path = self.portal.portal_contributions.getPath() | path = self.portal.portal_contributions.getPath() | ||
filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | ||
file_object = self.makeFileUpload(filename) | file_object = self.makeFileUpload(filename) | ||
response = self.publish('%s/%s' % (path, filename), | response = self.publish( | ||
request_method='PUT', | '%s/%s' % (path, filename), | ||
stdin=file_object, | request_method='PUT', | ||
basic=self.authentication) | stdin=file_object, | ||
env={"CONTENT_TYPE": 'application/vnd.oasis.opendocument.presentation'}, | |||
basic=self.authentication) | |||
self.assertEqual(response.getStatus(), six.moves.http_client.CREATED) | self.assertEqual(response.getStatus(), six.moves.http_client.CREATED) | ||
document_module = self.getDocumentModule() | document_module = self.getDocumentModule() | ||
... | @@ -126,10 +129,12 @@ class TestWebDavSupport(ERP5TypeTestCase): | ... | @@ -126,10 +129,12 @@ class TestWebDavSupport(ERP5TypeTestCase): |
path = self.portal.portal_contributions.getPath() | path = self.portal.portal_contributions.getPath() | ||
filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | ||
file_object = self.makeFileUpload(filename) | file_object = self.makeFileUpload(filename) | ||
response = self.publish('%s/%s' % (path, filename), | response = self.publish( | ||
request_method='PUT', | '%s/%s' % (path, filename), | ||
stdin=file_object, | request_method='PUT', | ||
basic=self.authentication) | stdin=file_object, | ||
env={"CONTENT_TYPE": 'application/vnd.oasis.opendocument.presentation'}, | |||
basic=self.authentication) | |||
self.assertEqual(response.getStatus(), six.moves.http_client.CREATED) | self.assertEqual(response.getStatus(), six.moves.http_client.CREATED) | ||
self.tic() | self.tic() | ||
... | @@ -198,10 +203,12 @@ class TestWebDavSupport(ERP5TypeTestCase): | ... | @@ -198,10 +203,12 @@ class TestWebDavSupport(ERP5TypeTestCase): |
path = self.portal.portal_contributions.getPath() | path = self.portal.portal_contributions.getPath() | ||
filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | ||
file_object = self.makeFileUpload(filename) | file_object = self.makeFileUpload(filename) | ||
response = self.publish('%s/%s' % (path, filename), | response = self.publish( | ||
request_method='PUT', | '%s/%s' % (path, filename), | ||
stdin=file_object, | request_method='PUT', | ||
basic=self.authentication) | stdin=file_object, | ||
env={"CONTENT_TYPE": 'application/vnd.oasis.opendocument.presentation'}, | |||
basic=self.authentication) | |||
# Convert to base format and run conversion into utf-8 | # Convert to base format and run conversion into utf-8 | ||
self.tic() | self.tic() | ||
... | @@ -225,10 +232,12 @@ class TestWebDavSupport(ERP5TypeTestCase): | ... | @@ -225,10 +232,12 @@ class TestWebDavSupport(ERP5TypeTestCase): |
path = self.portal.portal_contributions.getPath() | path = self.portal.portal_contributions.getPath() | ||
filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | ||
file_object = self.makeFileUpload(filename) | file_object = self.makeFileUpload(filename) | ||
response = self.publish('%s/%s' % (path, filename), | response = self.publish( | ||
request_method='PUT', | '%s/%s' % (path, filename), | ||
stdin=file_object, | request_method='PUT', | ||
basic=self.authentication) | stdin=file_object, | ||
env={"CONTENT_TYPE": 'application/vnd.oasis.opendocument.presentation'}, | |||
basic=self.authentication) | |||
document_module = self.getDocumentModule() | document_module = self.getDocumentModule() | ||
document = document_module[filename] | document = document_module[filename] | ||
... | @@ -263,10 +272,12 @@ class TestWebDavSupport(ERP5TypeTestCase): | ... | @@ -263,10 +272,12 @@ class TestWebDavSupport(ERP5TypeTestCase): |
path = self.portal.portal_contributions.getPath() | path = self.portal.portal_contributions.getPath() | ||
filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | filename = 'P-DMS-Presentation.3.Pages-001-en.odp' | ||
file_object = self.makeFileUpload(filename) | file_object = self.makeFileUpload(filename) | ||
response = self.publish('%s/%s' % (path, filename), | response = self.publish( | ||
request_method='PUT', | '%s/%s' % (path, filename), | ||
stdin=file_object, | request_method='PUT', | ||
basic=self.authentication) | stdin=file_object, | ||
env={"CONTENT_TYPE": 'application/vnd.oasis.opendocument.presentation'}, | |||
basic=self.authentication) | |||
document_module = self.getDocumentModule() | document_module = self.getDocumentModule() | ||
document = document_module[filename] | document = document_module[filename] | ||
... | ... |