Commit d80b2ec5 authored by Jérome Perrin's avatar Jérome Perrin

payroll_l10n_fr: simplify testDSNSocialDeclarationReport and fix py3 compatibility

unittest does a good job of explaining the differences when using
splitlines on long texts, no need to compute a diff ourselves.
parent e8fbe698
......@@ -24,13 +24,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
import difflib
import os
import time
import six
from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class TestDSNSocialDeclarationReport(ERP5TypeTestCase):
"""
Test Suite for the generation of the French Social Declaration Report,
......@@ -60,8 +60,13 @@ class TestDSNSocialDeclarationReport(ERP5TypeTestCase):
"""
test_dsn = self.dsn_module['test_model']
test_dsn.DSNMonthlyReport_makeReport()
reference_DSN = getattr(self.portal.portal_skins.erp5_payroll_l10n_fr_test, "test_model.dsn").data
diff_list = []
for unit_diff in difflib.unified_diff(reference_DSN.split('\n'), test_dsn.getTextContent().split('\n')):
diff_list.append(unit_diff)
self.assertEqual(reference_DSN, test_dsn.getTextContent(), msg='\n'.join(diff_list))
reference_DSN = bytes(
getattr(self.portal.portal_skins.erp5_payroll_l10n_fr_test, "test_model.dsn").data
)
if six.PY3:
reference_DSN = reference_DSN.decode('utf-8')
self.maxDiff = None
self.assertEqual(
test_dsn.getTextContent().splitlines(),
reference_DSN.splitlines(),
)
\ No newline at end of file
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