1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Removed hardcoded docs version in csrf template.

This commit is contained in:
Ryan Hiebert
2024-05-18 04:30:12 -05:00
committed by Sarah Boyce
parent 0b33a3abc2
commit c201014e85
2 changed files with 13 additions and 1 deletions

View File

@@ -132,3 +132,15 @@ class CsrfViewTests(SimpleTestCase):
with mock.patch.object(Path, "open") as m:
csrf_failure(mock.MagicMock(), mock.Mock())
m.assert_called_once_with(encoding="utf-8")
@override_settings(DEBUG=True)
@mock.patch("django.views.csrf.get_docs_version", return_value="4.2")
def test_doc_links(self, mocked_get_complete_version):
response = self.client.post("/")
self.assertContains(response, "Forbidden", status_code=403)
self.assertNotContains(
response, "https://docs.djangoproject.com/en/dev/", status_code=403
)
self.assertContains(
response, "https://docs.djangoproject.com/en/4.2/", status_code=403
)