diff --git a/iati_dashboard/tests/test_page_speed.py b/iati_dashboard/tests/test_page_speed.py index 384d6b901..7afaccaa0 100644 --- a/iati_dashboard/tests/test_page_speed.py +++ b/iati_dashboard/tests/test_page_speed.py @@ -79,7 +79,7 @@ "publisher/zsl.html", "codelist/2/document-link_@format.html", "element/iati-activity_activity-date_@iso-date.html", - "org_type/.html", + "org_type/accountable_org.html", "registration_agencies.html", ] diff --git a/iati_dashboard/ui/tests.py b/iati_dashboard/ui/tests.py index 5116a89b9..031cc5c2f 100644 --- a/iati_dashboard/ui/tests.py +++ b/iati_dashboard/ui/tests.py @@ -152,6 +152,8 @@ class OriginalDashboardRedirectTests(TestCase): list the tests as they run. """ + fixtures = ["publishers"] + def _url_and_view_helper(self, urls_and_views_to_check): """Checks that a set of URLs redirect to matching view functions""" @@ -236,20 +238,28 @@ def test_exploringdata(self): ) def test_slug_page_redirects(self): - """Test pages with slugs redirect to the section page""" + """Test pages with slugs redirect to their new locations""" self.assertRedirects( - self.client.get(r"/publisher/zsl.html"), reverse("dash-headlines-publishers"), status_code=301 + self.client.get(r"/publisher/zsl.html"), + reverse("dash-headlines-publisher-detail", args=["zsl"]), + status_code=301, ) - self.assertRedirects(self.client.get(r"/license/cc-by.html"), reverse("dash-licenses"), status_code=301) self.assertRedirects( - self.client.get(r"/codelist/2/budget_@type.html"), reverse("dash-exploringdata-codelists"), status_code=301 + self.client.get(r"/license/cc-by.html"), reverse("dash-licenses-detail", args=["cc-by"]), status_code=301 + ) + self.assertRedirects( + self.client.get(r"/codelist/2/budget_@type.html"), + reverse("dash-exploringdata-codelists-detail", args=["2", "budget_@type"]), + status_code=301, ) self.assertRedirects( self.client.get(r"/element/iati-activity_activity-date_@iso-date.html"), - reverse("dash-exploringdata-elements"), + reverse("dash-exploringdata-elements-detail", args=["iati-activity_activity-date_@iso-date"]), status_code=301, ) self.assertRedirects( - self.client.get(r"/org_type/funding_org.html"), reverse("dash-exploringdata-orgids"), status_code=301 + self.client.get(r"/org_type/funding_org.html"), + reverse("dash-exploringdata-orgtypes-detail", args=["funding_org"]), + status_code=301, ) diff --git a/iati_dashboard/ui/urls.py b/iati_dashboard/ui/urls.py index a7ab600b6..d64b0a48d 100644 --- a/iati_dashboard/ui/urls.py +++ b/iati_dashboard/ui/urls.py @@ -188,18 +188,23 @@ path("org_ids.html", RedirectView.as_view(pattern_name="dash-exploringdata-orgids", permanent=True)), path("faq.html", RedirectView.as_view(pattern_name="dash-faq", permanent=True)), path("licenses.html", RedirectView.as_view(pattern_name="dash-licenses", permanent=True)), - re_path(r"license\/\S*.html", RedirectView.as_view(pattern_name="dash-licenses", permanent=True)), + re_path(r"license\/(\S*).html", RedirectView.as_view(pattern_name="dash-licenses-detail", permanent=True)), re_path( - r"publisher\/\S*.html", RedirectView.as_view(pattern_name="dash-headlines-publishers", permanent=True) + r"publisher\/(\S*).html", + RedirectView.as_view(pattern_name="dash-headlines-publisher-detail", permanent=True), ), re_path( - r"codelist\/\d\/\S*.html", - RedirectView.as_view(pattern_name="dash-exploringdata-codelists", permanent=True), + r"codelist\/(\d)\/(\S*).html", + RedirectView.as_view(pattern_name="dash-exploringdata-codelists-detail", permanent=True), ), re_path( - r"element\/\S*.html", RedirectView.as_view(pattern_name="dash-exploringdata-elements", permanent=True) + r"element\/(\S*).html", + RedirectView.as_view(pattern_name="dash-exploringdata-elements-detail", permanent=True), + ), + re_path( + r"org_type\/(\S*).html", + RedirectView.as_view(pattern_name="dash-exploringdata-orgtypes-detail", permanent=True), ), - re_path(r"org_type\/\S*.html", RedirectView.as_view(pattern_name="dash-exploringdata-orgids", permanent=True)), ] + static("generated", document_root="out") + static("stats", document_root="stats-calculated")