From b5bc7e829aa121bf4597be7e151946bcc8e04d7d Mon Sep 17 00:00:00 2001 From: Chatewgne Date: Fri, 15 Nov 2024 14:41:05 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20[FEAT]=20Add=20tests=20for=20Cirkwi?= =?UTF-8?q?Parser=20(refs=20#3947)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- geotrek/cirkwi/parsers.py | 6 +- geotrek/cirkwi/tests/data/circuits.xml | 78 ++++- .../tests/data/circuits_wrong_locomotion.xml | 268 ++++++++++++++++++ geotrek/cirkwi/tests/data/poi.xml | 42 +++ geotrek/cirkwi/tests/factories.py | 10 + geotrek/cirkwi/tests/test_parsers.py | 59 +++- geotrek/tourism/tests/test_models.py | 6 +- 7 files changed, 443 insertions(+), 26 deletions(-) create mode 100644 geotrek/cirkwi/tests/data/circuits_wrong_locomotion.xml create mode 100644 geotrek/cirkwi/tests/factories.py diff --git a/geotrek/cirkwi/parsers.py b/geotrek/cirkwi/parsers.py index 5237cc2bb0..11995c2cb3 100644 --- a/geotrek/cirkwi/parsers.py +++ b/geotrek/cirkwi/parsers.py @@ -19,6 +19,7 @@ class CirkwiParser(AttachmentParserMixin, Parser): create = False provider = "Cirkwi" eid = 'eid' + auth = () default_language = settings.MODELTRANSLATION_DEFAULT_LANGUAGE field_options = { "geom": {"required": True}, @@ -193,7 +194,7 @@ def filter_description(self, src, val): if step_descriptions: desc += "
    \r\n" for step_description in step_descriptions: - desc += f"
  1. {step_description}
  2. \r\n" + desc += f"
  3. {step_description}
  4. " desc += "
" return desc @@ -221,9 +222,6 @@ class CirkwiTouristicContentParser(CirkwiParser): m2m_fields = { "type1": "categories/categorie/*", } - non_fields = { - 'attachments': "informations/information[@langue='']/medias/images/image/*" - } field_options = { "geom": {"required": True}, "name": {"required": True}, diff --git a/geotrek/cirkwi/tests/data/circuits.xml b/geotrek/cirkwi/tests/data/circuits.xml index 502b19b0d7..7e2e802714 100644 --- a/geotrek/cirkwi/tests/data/circuits.xml +++ b/geotrek/cirkwi/tests/data/circuits.xml @@ -1,4 +1,8 @@ + + 10925 + 10926 + @@ -60,6 +64,58 @@ + + + + + + + + + + + Étape 1 + + Au départ du terminal des car-ferrys. + + + + + + 62193 + + 50.9647654 + 1.8614236 + + 5.54 + + + + + + + + + Étape 2 + + Virer à droite, direction la plage-corniche de la Côte d'Opale. + + + + + + 62193 + + 50.9588189 + 1.8521179 + + 4.37 + + + + 74 @@ -83,13 +139,6 @@ - - - - - @@ -201,4 +250,19 @@ + + + + Le patrimoine de Plancoët à vélo + Laissez-vous guider par ce chemin + + + + + + + diff --git a/geotrek/cirkwi/tests/data/circuits_wrong_locomotion.xml b/geotrek/cirkwi/tests/data/circuits_wrong_locomotion.xml new file mode 100644 index 0000000000..84ca8cd859 --- /dev/null +++ b/geotrek/cirkwi/tests/data/circuits_wrong_locomotion.xml @@ -0,0 +1,268 @@ + + + 10925 + 10926 + + + + + Le patrimoine de Plancoët + Laissez-vous guider par ce chemin + + + + Le patrimoine de Plancoët + https://example.net/a_picture.jpg + Manon + + + https://example.net/a_picture.jpg + + + +