From f47a87558211b44d02ba95d19f185688a8826e37 Mon Sep 17 00:00:00 2001 From: juggler31 Date: Thu, 26 Oct 2023 11:17:28 +0200 Subject: [PATCH] Hot fix provider_choices (#3810) Co-authored-by: Jean-Etienne Castagnede --- geotrek/core/tests/test_views.py | 16 +++++++-------- geotrek/infrastructure/tests/test_views.py | 8 ++++---- geotrek/outdoor/tests/test_views.py | 16 +++++++-------- geotrek/sensitivity/tests/test_views.py | 8 ++++---- geotrek/signage/managers.py | 5 ----- geotrek/tourism/tests/test_views.py | 16 +++++++-------- geotrek/trekking/tests/test_views.py | 24 +++++++++++----------- 7 files changed, 44 insertions(+), 49 deletions(-) diff --git a/geotrek/core/tests/test_views.py b/geotrek/core/tests/test_views.py index 3a1c1eb516..5feb5728cf 100644 --- a/geotrek/core/tests/test_views.py +++ b/geotrek/core/tests/test_views.py @@ -888,8 +888,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = PathFactory.create(provider='my_provider1') - signage2 = PathFactory.create(provider='my_provider2') + path1 = PathFactory.create(provider='my_provider1') + path2 = PathFactory.create(provider='my_provider2') filter_set = PathFilterSet() filter_form = filter_set.form @@ -897,8 +897,8 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(path1, filter_set.qs) + self.assertIn(path2, filter_set.qs) class TrailFilterTest(CommonTest, AuthentFixturesTest): @@ -913,8 +913,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = TrailFactory.create(provider='my_provider1') - signage2 = TrailFactory.create(provider='my_provider2') + trail1 = TrailFactory.create(provider='my_provider1') + trail2 = TrailFactory.create(provider='my_provider2') filter_set = TrailFilterSet() filter_form = filter_set.form @@ -922,5 +922,5 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(trail1, filter_set.qs) + self.assertIn(trail2, filter_set.qs) diff --git a/geotrek/infrastructure/tests/test_views.py b/geotrek/infrastructure/tests/test_views.py index e24745e436..b01b336684 100755 --- a/geotrek/infrastructure/tests/test_views.py +++ b/geotrek/infrastructure/tests/test_views.py @@ -131,8 +131,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = InfrastructureFactory.create(provider='my_provider1') - signage2 = InfrastructureFactory.create(provider='my_provider2') + infrastructure1 = InfrastructureFactory.create(provider='my_provider1') + infrastructure2 = InfrastructureFactory.create(provider='my_provider2') filter_set = InfrastructureFilterSet() filter_form = filter_set.form @@ -140,5 +140,5 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(infrastructure1, filter_set.qs) + self.assertIn(infrastructure2, filter_set.qs) diff --git a/geotrek/outdoor/tests/test_views.py b/geotrek/outdoor/tests/test_views.py index a0b060376e..64d0dc78fb 100644 --- a/geotrek/outdoor/tests/test_views.py +++ b/geotrek/outdoor/tests/test_views.py @@ -176,8 +176,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = SiteFactory.create(provider='my_provider1') - signage2 = SiteFactory.create(provider='my_provider2') + site1 = SiteFactory.create(provider='my_provider1') + site2 = SiteFactory.create(provider='my_provider2') filter_set = SiteFilterSet() filter_form = filter_set.form @@ -185,8 +185,8 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(site1, filter_set.qs) + self.assertIn(site2, filter_set.qs) class CourseFilterTest(TestCase): @@ -201,8 +201,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = CourseFactory.create(provider='my_provider1') - signage2 = CourseFactory.create(provider='my_provider2') + course1 = CourseFactory.create(provider='my_provider1') + course2 = CourseFactory.create(provider='my_provider2') filter_set = CourseFilterSet() filter_form = filter_set.form @@ -210,5 +210,5 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(course1, filter_set.qs) + self.assertIn(course2, filter_set.qs) diff --git a/geotrek/sensitivity/tests/test_views.py b/geotrek/sensitivity/tests/test_views.py index d25691374c..e4a7cad644 100644 --- a/geotrek/sensitivity/tests/test_views.py +++ b/geotrek/sensitivity/tests/test_views.py @@ -386,8 +386,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = SensitiveAreaFactory.create(provider='my_provider1') - signage2 = SensitiveAreaFactory.create(provider='my_provider2') + sensitive_area1 = SensitiveAreaFactory.create(provider='my_provider1') + sensitive_area2 = SensitiveAreaFactory.create(provider='my_provider2') filter_set = SensitiveAreaFilterSet() filter_form = filter_set.form @@ -395,5 +395,5 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(sensitive_area1, filter_set.qs) + self.assertIn(sensitive_area2, filter_set.qs) diff --git a/geotrek/signage/managers.py b/geotrek/signage/managers.py index 1bc39e5a37..55d0f7fb17 100644 --- a/geotrek/signage/managers.py +++ b/geotrek/signage/managers.py @@ -8,8 +8,3 @@ def implantation_year_choices(self): .order_by('-implantation_year').distinct('implantation_year') \ .values_list('implantation_year', flat=True) return tuple((value, value) for value in values) - - # def provider_choices(self): - # providers = self.get_queryset().existing().exclude(provider__exact='') \ - # .distinct('provider').values_list('provider', 'provider') - # return providers diff --git a/geotrek/tourism/tests/test_views.py b/geotrek/tourism/tests/test_views.py index 328f917437..86559b244e 100644 --- a/geotrek/tourism/tests/test_views.py +++ b/geotrek/tourism/tests/test_views.py @@ -581,8 +581,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = TouristicContentFactory.create(provider='my_provider1') - signage2 = TouristicContentFactory.create(provider='my_provider2') + touristic_content1 = TouristicContentFactory.create(provider='my_provider1') + touristic_content2 = TouristicContentFactory.create(provider='my_provider2') filter_set = TouristicContentFilterSet() filter_form = filter_set.form @@ -590,8 +590,8 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(touristic_content1, filter_set.qs) + self.assertIn(touristic_content2, filter_set.qs) class TouristicEventFilterTest(TestCase): @@ -606,8 +606,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = TouristicEventFactory.create(provider='my_provider1') - signage2 = TouristicEventFactory.create(provider='my_provider2') + touristic_event1 = TouristicEventFactory.create(provider='my_provider1') + touristic_event2 = TouristicEventFactory.create(provider='my_provider2') filter_set = TouristicEventFilterSet() filter_form = filter_set.form @@ -615,5 +615,5 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(touristic_event1, filter_set.qs) + self.assertIn(touristic_event2, filter_set.qs) diff --git a/geotrek/trekking/tests/test_views.py b/geotrek/trekking/tests/test_views.py index 141d78959f..60c77ce5c3 100755 --- a/geotrek/trekking/tests/test_views.py +++ b/geotrek/trekking/tests/test_views.py @@ -1668,8 +1668,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = TrekFactory.create(provider='my_provider1') - signage2 = TrekFactory.create(provider='my_provider2') + trek1 = TrekFactory.create(provider='my_provider1') + trek2 = TrekFactory.create(provider='my_provider2') filter_set = TrekFilterSet() filter_form = filter_set.form @@ -1677,8 +1677,8 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(trek1, filter_set.qs) + self.assertIn(trek2, filter_set.qs) class POIFilterTest(TestCase): @@ -1693,8 +1693,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = POIFactory.create(provider='my_provider1') - signage2 = POIFactory.create(provider='my_provider2') + poi1 = POIFactory.create(provider='my_provider1') + poi2 = POIFactory.create(provider='my_provider2') filter_set = POIFilterSet() filter_form = filter_set.form @@ -1702,8 +1702,8 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(poi1, filter_set.qs) + self.assertIn(poi2, filter_set.qs) class ServiceFilterTest(TestCase): @@ -1718,8 +1718,8 @@ def test_provider_filter_without_provider(self): self.assertEqual(0, filter_set.qs.count()) def test_provider_filter_with_providers(self): - signage1 = ServiceFactory.create(provider='my_provider1') - signage2 = ServiceFactory.create(provider='my_provider2') + service1 = ServiceFactory.create(provider='my_provider1') + service2 = ServiceFactory.create(provider='my_provider2') filter_set = ServiceFilterSet() filter_form = filter_set.form @@ -1727,5 +1727,5 @@ def test_provider_filter_with_providers(self): self.assertIn('', filter_form.as_p()) self.assertIn('', filter_form.as_p()) - self.assertIn(signage1, filter_set.qs) - self.assertIn(signage2, filter_set.qs) + self.assertIn(service1, filter_set.qs) + self.assertIn(service2, filter_set.qs)