From 37ab598d0d58c04f76ed9c40256b68b3022a557f Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Thu, 25 Aug 2022 14:07:08 +0100 Subject: [PATCH] Move well-known templates to well-known app --- website/common/tests/test_pages.py | 4 ++-- website/common/tests/test_views.py | 2 +- .../templates/well-known}/matrix-client.json | 0 .../templates/well-known}/matrix-server.json | 0 .../templates/well-known}/security.txt | 0 website/well_known/tests.py | 4 ++-- website/well_known/views.py | 6 +++--- 7 files changed, 8 insertions(+), 8 deletions(-) rename website/{common/templates => well_known/templates/well-known}/matrix-client.json (100%) rename website/{common/templates => well_known/templates/well-known}/matrix-server.json (100%) rename website/{common/templates => well_known/templates/well-known}/security.txt (100%) diff --git a/website/common/tests/test_pages.py b/website/common/tests/test_pages.py index 87dcb19..6a65edc 100644 --- a/website/common/tests/test_pages.py +++ b/website/common/tests/test_pages.py @@ -35,7 +35,7 @@ class ContentPageTestCase(TestCase): self.assertEqual(response.status_code, 200) def test_queries(self) -> None: - with self.assertNumQueries(17): + with self.assertNumQueries(21): self.client.get(self.page.url) @@ -57,5 +57,5 @@ class ListingPageTestCase(TestCase): self.assertEqual(len(response.context["child_pages"]), 2) def test_queries(self) -> None: - with self.assertNumQueries(20): + with self.assertNumQueries(24): self.client.get(self.page.url) diff --git a/website/common/tests/test_views.py b/website/common/tests/test_views.py index be3ab9c..3607393 100644 --- a/website/common/tests/test_views.py +++ b/website/common/tests/test_views.py @@ -16,7 +16,7 @@ class Error404PageTestCase(TestCase): ) def test_queries(self) -> None: - with self.assertNumQueries(8): + with self.assertNumQueries(12): self.client.get(self.url) diff --git a/website/common/templates/matrix-client.json b/website/well_known/templates/well-known/matrix-client.json similarity index 100% rename from website/common/templates/matrix-client.json rename to website/well_known/templates/well-known/matrix-client.json diff --git a/website/common/templates/matrix-server.json b/website/well_known/templates/well-known/matrix-server.json similarity index 100% rename from website/common/templates/matrix-server.json rename to website/well_known/templates/well-known/matrix-server.json diff --git a/website/common/templates/security.txt b/website/well_known/templates/well-known/security.txt similarity index 100% rename from website/common/templates/security.txt rename to website/well_known/templates/well-known/security.txt diff --git a/website/well_known/tests.py b/website/well_known/tests.py index 6ecc615..fe8a8f3 100644 --- a/website/well_known/tests.py +++ b/website/well_known/tests.py @@ -25,7 +25,7 @@ class MatrixServerViewTestCase(SimpleTestCase): response = self.client.get(self.url) self.assertEqual(response.status_code, 200) self.assertEqual(response["Content-Type"], "application/json") - self.assertTemplateUsed(response, "matrix-server.json") + self.assertTemplateUsed(response, "well-known/matrix-server.json") class MatrixClientViewTestCase(SimpleTestCase): @@ -35,4 +35,4 @@ class MatrixClientViewTestCase(SimpleTestCase): response = self.client.get(self.url) self.assertEqual(response.status_code, 200) self.assertEqual(response["Content-Type"], "application/json") - self.assertTemplateUsed(response, "matrix-client.json") + self.assertTemplateUsed(response, "well-known/matrix-client.json") diff --git a/website/well_known/views.py b/website/well_known/views.py index 0d7e5a2..6f121e6 100644 --- a/website/well_known/views.py +++ b/website/well_known/views.py @@ -11,7 +11,7 @@ from website.contact.models import ContactPage class SecurityView(TemplateView): - template_name = "security.txt" + template_name = "well-known/security.txt" content_type = "text/plain" expires = timedelta(days=7) @@ -32,11 +32,11 @@ class SecurityView(TemplateView): @method_decorator(cache_page(60 * 60), name="dispatch") class MatrixServerView(TemplateView): - template_name = "matrix-server.json" + template_name = "well-known/matrix-server.json" content_type = "application/json" @method_decorator(cache_page(60 * 60), name="dispatch") class MatrixClientView(TemplateView): - template_name = "matrix-client.json" + template_name = "well-known/matrix-client.json" content_type = "application/json"