Skip to content

Commit

Permalink
✅ [TEST] Change OutdoorParser test language (refs #3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chatewgne committed Feb 19, 2024
1 parent d9f3e61 commit d75502d
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
},
"outdoor_practice": {
"Renamed Practice": [
"Escalade"
"Climbing"
]
},
"outdoor_ratingscale": {
"Renamed Rating Scale": [
"Cotation"
"Class"
]
},
"outdoor_rating": {
Expand All @@ -31,12 +31,12 @@
},
"outdoor_sitetype": {
"Renamed Site Type": [
"Ecole"
"School"
]
},
"outdoor_coursetype": {
"Renamed Course Type": [
"Type 1"
"Type 1 en"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"id": 35,
"name": {
"en": null,
"en": "3+",
"fr": "3+"
},
"description": {
Expand All @@ -20,7 +20,7 @@
{
"id": 36,
"name": {
"en": null,
"en": "4a",
"fr": "4a"
},
"description": {
Expand All @@ -34,7 +34,7 @@
{
"id": 38,
"name": {
"en": null,
"en": "4c",
"fr": "4c"
},
"description": {
Expand Down
68 changes: 33 additions & 35 deletions geotrek/outdoor/tests/test_parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
SiteType)


@override_settings(MODELTRANSLATION_DEFAULT_LANGUAGE="fr")
@skipIf(settings.TREKKING_TOPOLOGY_ENABLED, 'Test without dynamic segmentation only')
class MappingOutdoorGeotrekParserTests(GeotrekParserTestMixin, TestCase):

Expand Down Expand Up @@ -74,7 +73,6 @@ def test_geotrek_aggregator_parser_mapping(self, mocked_head, mocked_get):
self.assertEqual(str(site.type), 'Renamed Site Type')


@override_settings(MODELTRANSLATION_DEFAULT_LANGUAGE="fr")
@skipIf(settings.TREKKING_TOPOLOGY_ENABLED, 'Test without dynamic segmentation only')
class OutdoorGeotrekParserTests(GeotrekParserTestMixin, TestCase):

Expand Down Expand Up @@ -135,35 +133,35 @@ def test_create_sites_and_courses(self, mocked_head, mocked_get):
self.assertEqual(site.published_it, False)
self.assertEqual(site.published_es, False)
self.assertEqual(str(site.practice.sector), 'Vertical')
self.assertEqual(str(site.practice), 'Escalade')
self.assertEqual(str(site.labels.first()), 'Label fr')
self.assertEqual(str(site.practice), 'Climbing')
self.assertEqual(str(site.labels.first()), 'Label en')
self.assertEqual(site.ratings.count(), 3)
self.assertEqual(str(site.ratings.first()), 'Cotation : 3+')
self.assertEqual(site.ratings.first().description, 'Une description')
self.assertEqual(str(site.ratings.first()), 'Class : 3+')
self.assertEqual(site.ratings.first().description, 'A description')
self.assertEqual(site.ratings.first().order, 302)
self.assertEqual(site.ratings.first().color, '#D9D9D8')
self.assertEqual(str(site.ratings.first().scale), 'Cotation (Escalade)')
self.assertEqual(str(site.type), 'Ecole')
self.assertEqual(str(site.type.practice), 'Escalade')
self.assertEqual(str(site.ratings.first().scale), 'Class (Climbing)')
self.assertEqual(str(site.type), 'School')
self.assertEqual(str(site.type.practice), 'Climbing')
self.assertAlmostEqual(site.geom[0][0][0][0], 970023.8976707931, places=5)
self.assertAlmostEqual(site.geom[0][0][0][1], 6308806.903248067, places=5)
self.assertAlmostEqual(site.geom[0][0][1][0], 967898.282139539, places=5)
self.assertAlmostEqual(site.geom[0][0][1][1], 6358768.657410889, places=5)
self.assertEqual(str(site.labels.first()), "Label fr")
self.assertEqual(str(site.labels.first()), "Label en")
self.assertEqual(str(site.source.first()), "Source")
self.assertEqual(str(site.themes.first()), "Test thème fr")
self.assertEqual(str(site.themes.first()), "Test thème en")
self.assertEqual(str(site.managers.first()), "Organisme")
self.assertEqual(str(site.structure), "Test structure")
self.assertEqual(site.description_teaser, "Test fr")
self.assertEqual(site.description_teaser_en, "Test en")
self.assertEqual(site.description, "Test descr fr")
self.assertEqual(site.description_en, "Test descr en")
self.assertEqual(site.advice, "Test reco fr")
self.assertEqual(site.accessibility, "Test access fr")
self.assertEqual(site.period, "Test périod fr")
self.assertEqual(site.description_teaser, "Test en")
self.assertEqual(site.description_teaser_fr, "Test fr")
self.assertEqual(site.description, "Test descr en")
self.assertEqual(site.description_fr, "Test descr fr")
self.assertEqual(site.advice, "Test reco en")
self.assertEqual(site.accessibility, "Test access en")
self.assertEqual(site.period, "Test période en")
self.assertEqual(site.orientation, ['NE', 'S'])
self.assertEqual(site.ambiance, "Test ambiance fr")
self.assertEqual(site.ambiance_en, "Test ambiance en")
self.assertEqual(site.ambiance, "Test ambiance en")
self.assertEqual(site.ambiance_fr, "Test ambiance fr")
self.assertEqual(site.wind, ['N', 'E'])
self.assertEqual(str(site.structure), 'Test structure')
# TODO ; self.assertEqual(site.information_desks.count(), 1)
Expand All @@ -180,33 +178,33 @@ def test_create_sites_and_courses(self, mocked_head, mocked_get):
# Courses
self.assertEqual(Course.objects.count(), 7)
course = Course.objects.get(name_fr="Feuille 1", name_en="Leaf 1")
self.assertEqual(str(course.type), 'Type 1')
self.assertEqual(str(course.type), 'Type 1 en')
self.assertEqual(course.published, True)
self.assertEqual(course.published_fr, True)
self.assertEqual(course.published_en, True)
self.assertEqual(course.published_it, False)
self.assertEqual(course.published_es, False)
self.assertEqual(course.ratings.count(), 1)
self.assertEqual(str(course.ratings.first()), 'Cotation : 3+')
self.assertEqual(course.ratings.first().description, 'Une description')
self.assertEqual(str(course.ratings.first()), 'Class : 3+')
self.assertEqual(course.ratings.first().description, 'A description')
self.assertEqual(course.ratings.first().order, 302)
self.assertEqual(course.ratings.first().color, '#D9D9D8')
self.assertEqual(str(course.ratings.first().scale), 'Cotation (Escalade)')
self.assertEqual(str(course.ratings.first().scale), 'Class (Climbing)')
self.assertAlmostEqual(course.geom.coords[0][0], 994912.1442530667, places=5)
self.assertAlmostEqual(course.geom.coords[0][1], 6347387.846494712, places=5)
self.assertEqual(str(course.structure), "Test structure")
self.assertEqual(course.description, "Test descr fr")
self.assertEqual(course.description_en, "Test descr en")
self.assertEqual(course.ratings_description, "Test descr fr")
self.assertEqual(course.ratings_description_en, "Test descr en")
self.assertEqual(course.equipment, "Test équipement fr")
self.assertEqual(course.equipment_en, "Test équipement en")
self.assertEqual(course.gear, "Test matériel fr")
self.assertEqual(course.gear_en, "Test matériel en")
self.assertEqual(course.advice, "Test reco fr")
self.assertEqual(course.description, "Test descr en")
self.assertEqual(course.description_fr, "Test descr fr")
self.assertEqual(course.ratings_description, "Test descr en")
self.assertEqual(course.ratings_description_fr, "Test descr fr")
self.assertEqual(course.equipment, "Test équipement en")
self.assertEqual(course.equipment_fr, "Test équipement fr")
self.assertEqual(course.gear, "Test matériel en")
self.assertEqual(course.gear_fr, "Test matériel fr")
self.assertEqual(course.advice, "Test reco en")
self.assertEqual(course.duration, 100)
self.assertEqual(course.height, 100)
self.assertEqual(course.accessibility, "Test access fr")
self.assertEqual(course.accessibility, "Test access en")
self.assertEqual(str(course.structure), 'Test structure')
# TODO : self.assertEqual(course.excluded_pois.count(), 1)
self.assertEqual(course.eid, "840f4cf7-dbe0-4aa1-835f-c1219c45dd7a")
Expand All @@ -217,7 +215,7 @@ def test_create_sites_and_courses(self, mocked_head, mocked_get):
parent_site = Site.objects.get(name_fr="Noeud 2 bis")
self.assertEqual(course.parent_sites.count(), 1)
self.assertEqual(course.parent_sites.first(), parent_site)
self.assertEqual(str(course.parent_sites.first().practice), 'Escalade')
self.assertEqual(str(course.parent_sites.first().practice), 'Climbing')
child_course_1 = Course.objects.get(name="Step 1")
child_course_2 = Course.objects.get(name="Step 2")
child_course_3 = Course.objects.get(name="Step 3")
Expand Down

0 comments on commit d75502d

Please sign in to comment.