From 017da0cd9ae38b76377f959f05f5913bb8b296f4 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 21 Jun 2021 16:44:54 +0200 Subject: Tests: fix dependencies and string evaluation --- archaeological_finds/tests.py | 5 ++++- archaeological_operations/tests.py | 2 +- archaeological_operations/tests/labels-8.odt | Bin 12838 -> 13283 bytes ishtar_common/tests.py | 4 +++- ishtar_common/utils_secretary.py | 3 +-- requirements.txt | 1 + 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index c9ee0f9ed..cb5ca5644 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -873,10 +873,13 @@ class ImportFindTest(ImportTest, FindInit, TestCase): impt.importation() # check errors self.assertEqual(len(impt.errors), 2) + error_msg = str( + _("The division {} {} do not exist for the location {}.") + ).format("Area", "43", "Warehouse test") for error in impt.errors: self.assertEqual( error["error"], - "The division Area 43 do not exist for the location Warehouse " "test.", + error_msg ) def tearDown(self): diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 09920cf13..39fa730f0 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -3120,7 +3120,7 @@ class LabelTest(TestCase, OperationInitTest): self.assertIsNone(z.testzip()) content = z.open("content.xml") full_content = content.read() - self.assertIn(b"1789", full_content) + self.assertIn(b"1789", full_content, msg="1789 not in generated label") # jpe file are added for missing pictures / must be filtered self.assertNotIn(b'.jpe"', full_content) finally: diff --git a/archaeological_operations/tests/labels-8.odt b/archaeological_operations/tests/labels-8.odt index 13229c526..58e00e72f 100644 Binary files a/archaeological_operations/tests/labels-8.odt and b/archaeological_operations/tests/labels-8.odt differ diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 85d658160..e535eda4b 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -797,6 +797,7 @@ class SerializationTest(GenericSerializationTest, TestCase): AlterationCauseType, TreatmentEmergencyType, CommunicabilityType, + FunctionalArea ) from archaeological_operations.models import CulturalAttributionType @@ -809,6 +810,7 @@ class SerializationTest(GenericSerializationTest, TestCase): TreatmentEmergencyType, CommunicabilityType, CulturalAttributionType, + FunctionalArea, ): model.objects.create(txt_idx="test", label="Test") @@ -2054,7 +2056,7 @@ class ShortMenuTest(TestCase): ope.save() response = c.get(reverse("shortcut-menu")) self.assertEqual(response.status_code, 200) - self.assertFalse(str(ope.cached_label) in response.content.decode()) + self.assertIn(ope.cached_label, response.content.decode()) # test current is not owned ope.end_date = None diff --git a/ishtar_common/utils_secretary.py b/ishtar_common/utils_secretary.py index 9100dac15..062b43913 100644 --- a/ishtar_common/utils_secretary.py +++ b/ishtar_common/utils_secretary.py @@ -1,6 +1,5 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- - from secretary import Renderer, parseString from xml.parsers.expat import ExpatError, ErrorString @@ -142,7 +141,7 @@ class IshtarSecretaryRenderer(Renderer): return final_xml except ExpatError as e: - if not "result" in locals(): + if "result" not in locals(): result = xml_source ### changes try: diff --git a/requirements.txt b/requirements.txt index 45ae30150..72b40cd31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -18,6 +18,7 @@ djangorestframework==3.9 pytidylib==0.3.2 lxml==4.3.2 +Jinja2==2.10 django-extra-views==0.12.0 beautifulsoup4==4.7.1 -- cgit v1.2.3