mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Removed hardcoded docs version in csrf template.
This commit is contained in:
parent
0b33a3abc2
commit
c201014e85
@ -53,7 +53,7 @@
|
|||||||
<li>Your browser is accepting cookies.</li>
|
<li>Your browser is accepting cookies.</li>
|
||||||
|
|
||||||
<li>The view function passes a <code>request</code> to the template’s <a
|
<li>The view function passes a <code>request</code> to the template’s <a
|
||||||
href="https://docs.djangoproject.com/en/dev/topics/templates/#django.template.backends.base.Template.render"><code>render</code></a>
|
href="https://docs.djangoproject.com/en/{{ docs_version }}/topics/templates/#django.template.backends.base.Template.render"><code>render</code></a>
|
||||||
method.</li>
|
method.</li>
|
||||||
|
|
||||||
<li>In the template, there is a <code>{% templatetag openblock %} csrf_token
|
<li>In the template, there is a <code>{% templatetag openblock %} csrf_token
|
||||||
|
@ -132,3 +132,15 @@ class CsrfViewTests(SimpleTestCase):
|
|||||||
with mock.patch.object(Path, "open") as m:
|
with mock.patch.object(Path, "open") as m:
|
||||||
csrf_failure(mock.MagicMock(), mock.Mock())
|
csrf_failure(mock.MagicMock(), mock.Mock())
|
||||||
m.assert_called_once_with(encoding="utf-8")
|
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
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user