From 2d56a09ddc9db68c8f8cb3843a1e0bbf2f37fc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Fri, 5 May 2023 22:20:25 +0900 Subject: [PATCH] testHalJsonStyle: fix expected CSV content type header This is forwarded from cloudooo and now that cloudooo use libreoffice 7 it sets the correct ( according to rfc4180 ) content type for CSV see https://www.rfc-editor.org/rfc/rfc4180#page-4 --- .../portal_components/test.erp5.testHalJsonStyle.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py b/bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py index 31f15be870..9a9bd21919 100644 --- a/bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py +++ b/bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py @@ -3,6 +3,7 @@ import transaction from zExceptions import Unauthorized from Products.ERP5Type.tests.utils import createZODBPythonScript +from Products.ERP5Type import IS_ZOPE2 from unittest import skip from functools import wraps @@ -3180,7 +3181,10 @@ class TestERP5ODS(ERP5HALJSONStyleSkinsMixin): ) self.assertEqual(fake_request.get('portal_skin'), 'ODS') self.assertEqual(fake_request.RESPONSE.status, 200) - self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'), 'application/csv') + if IS_ZOPE2: + self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'), 'text/csv') + else: + self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'), 'text/csv; charset=utf-8') expected_csv = 'Title,Creation Date\nfoook2,XX/XX/XXXX XX:XX:XX\nfoook1,XX/XX/XXXX XX:XX:XX\n' self.assertEqual(len(result), len(expected_csv), result) prefix_length = len('Title,Creation Date\nfoook2,') @@ -3241,7 +3245,10 @@ class TestERP5ODS(ERP5HALJSONStyleSkinsMixin): ) self.assertEqual(fake_request.get('portal_skin'), 'ODS') self.assertEqual(fake_request.RESPONSE.status, 200) - self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'), 'application/csv') + if IS_ZOPE2: + self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'), 'text/csv') + else: + self.assertEqual(fake_request.RESPONSE.getHeader('Content-Type'), 'text/csv; charset=utf-8') self.assertTrue('foook1' in result, result) self.assertTrue('foook2' in result, result) self.assertTrue('foonotok' not in result, result) -- 2.30.9