diff --git a/config/settings/test.py b/config/settings/test.py index 0c339eb0b..0954ef94a 100644 --- a/config/settings/test.py +++ b/config/settings/test.py @@ -24,6 +24,9 @@ "default": { "BACKEND": "django.core.cache.backends.dummy.DummyCache", }, + "local_storage": { + "BACKEND": "django.core.cache.backends.dummy.DummyCache", + }, } # PASSWORDS diff --git a/config/urls.py b/config/urls.py index 1e55b74ad..522fe5144 100644 --- a/config/urls.py +++ b/config/urls.py @@ -2,7 +2,7 @@ from django.conf.urls import include from django.contrib import admin from django.http import HttpResponse -from django.urls import path +from django.urls import path, re_path from django.views import defaults as default_views from django.views.decorators.cache import cache_page @@ -21,8 +21,8 @@ ), name="schema-swagger-ui", ), - path( - r"schema/", + re_path( + r"^schema\/(?:\?format=(?Pjson|yaml))?$", cache_page(schema_cache_timeout, cache="local_storage")( SpectacularAPIView().as_view() ), diff --git a/safe_transaction_service/history/tests/test_views.py b/safe_transaction_service/history/tests/test_views.py index f36dddc40..65526c6e7 100644 --- a/safe_transaction_service/history/tests/test_views.py +++ b/safe_transaction_service/history/tests/test_views.py @@ -91,7 +91,7 @@ def test_about_view(self): self.assertEqual(response.status_code, status.HTTP_200_OK) def test_swagger_json_schema(self): - url = reverse("schema-json", args=(".json",)) + url = reverse("schema-json") + "?format=json" response = self.client.get(url, format="json") self.assertEqual(response.status_code, status.HTTP_200_OK)