diff --git a/swh/web/api/apiresponse.py b/swh/web/api/apiresponse.py --- a/swh/web/api/apiresponse.py +++ b/swh/web/api/apiresponse.py @@ -159,7 +159,7 @@ doc_data["endpoint_path"][-1]["path"] += "/doc/" response = render( - request, "api/apidoc.html", doc_data, status=doc_data["status_code"] + request, "apidoc.html", doc_data, status=doc_data["status_code"] ) # otherwise simply return the raw data and let DRF picks diff --git a/swh/web/templates/api/endpoints.html b/swh/web/api/templates/api-endpoints.html rename from swh/web/templates/api/endpoints.html rename to swh/web/api/templates/api-endpoints.html diff --git a/swh/web/templates/api/api.html b/swh/web/api/templates/api.html rename from swh/web/templates/api/api.html rename to swh/web/api/templates/api.html diff --git a/swh/web/templates/api/apidoc.html b/swh/web/api/templates/apidoc.html rename from swh/web/templates/api/apidoc.html rename to swh/web/api/templates/apidoc.html diff --git a/swh/web/api/views/utils.py b/swh/web/api/views/utils.py --- a/swh/web/api/views/utils.py +++ b/swh/web/api/views/utils.py @@ -74,7 +74,7 @@ @api_view(["GET", "HEAD"]) def api_home(request: Request): - return Response({}, template_name="api/api.html") + return Response({}, template_name="api.html") APIUrls.add_url_pattern(r"^api/$", api_home, view_name="api-1-homepage") @@ -88,4 +88,4 @@ doc["doc_intro"] = doc["docstring"].split("\n\n")[0] # Return a list of routes with consistent ordering env = {"doc_routes": sorted(routes.items())} - return Response(env, template_name="api/endpoints.html") + return Response(env, template_name="api-endpoints.html") diff --git a/swh/web/tests/api/test_apidoc.py b/swh/web/tests/api/test_apidoc.py --- a/swh/web/tests/api/test_apidoc.py +++ b/swh/web/tests/api/test_apidoc.py @@ -97,9 +97,7 @@ def test_apidoc_route_doc(client): url = reverse("api-1-some-doc-route-doc") - check_html_get_response( - client, url, status_code=200, template_used="api/apidoc.html" - ) + check_html_get_response(client, url, status_code=200, template_used="apidoc.html") def test_apidoc_route_fn(api_client): @@ -138,9 +136,7 @@ def test_apidoc_full_stack_doc(client): url = reverse("api-1-some-complete-doc-route-doc") - check_html_get_response( - client, url, status_code=200, template_used="api/apidoc.html" - ) + check_html_get_response(client, url, status_code=200, template_used="apidoc.html") def test_apidoc_full_stack_fn(api_client): @@ -163,9 +159,7 @@ # a dedicated view accepting GET requests should have # been created to display the HTML documentation url = reverse("api-1-test-post-only-doc") - check_html_get_response( - client, url, status_code=200, template_used="api/apidoc.html" - ) + check_html_get_response(client, url, status_code=200, template_used="apidoc.html") def test_api_doc_parse_httpdomain(): @@ -364,7 +358,7 @@ def test_apidoc_input_output_doc(client): url = reverse("api-1-post-endpoint-doc") rv = check_html_get_response( - client, url, status_code=200, template_used="api/apidoc.html" + client, url, status_code=200, template_used="apidoc.html" ) input_html_doc = textwrap.indent( @@ -449,7 +443,7 @@ def test_apidoc_with_links(client): url = reverse("api-1-endpoint-links-in-doc") rv = check_html_get_response( - client, url, status_code=200, template_used="api/apidoc.html" + client, url, status_code=200, template_used="apidoc.html" ) html = prettify_html(rv.content)