summaryrefslogtreecommitdiff
path: root/tests/admin_docs/test_views.py
diff options
context:
space:
mode:
authorsai-ganesh-03 <sandursaiganesh@gmail.com>2024-11-03 11:03:48 +0530
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-11-06 14:39:18 +0100
commitc2c544cf01107da158cb8c0c539555eafa0628db (patch)
treed3387e60d7e0e9f5a0c59648c31473fc2836567f /tests/admin_docs/test_views.py
parent78c9a2703151432f8e35cb63fca5a566fee5f8ed (diff)
Fixed #27409 -- Made admindocs support custom link text in docstrings.
Diffstat (limited to 'tests/admin_docs/test_views.py')
-rw-r--r--tests/admin_docs/test_views.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py
index c48a89a1b0..f7232a7e03 100644
--- a/tests/admin_docs/test_views.py
+++ b/tests/admin_docs/test_views.py
@@ -441,6 +441,25 @@ class TestModelDetailView(TestDataMixin, AdminDocsTestCase):
self.assertContains(self.response, body, html=True)
self.assertContains(self.response, model_body, html=True)
+ def test_model_docstring_built_in_tag_links(self):
+ summary = "Links with different link text."
+ body = (
+ '<p>This is a line with tag <a class="reference external" '
+ 'href="/admindocs/tags/#built_in-extends">extends</a>\n'
+ 'This is a line with model <a class="reference external" '
+ 'href="/admindocs/models/myapp.family/">Family</a>\n'
+ 'This is a line with view <a class="reference external" '
+ 'href="/admindocs/views/myapp.views.Index/">Index</a>\n'
+ 'This is a line with template <a class="reference external" '
+ 'href="/admindocs/templates/Index.html/">index template</a>\n'
+ 'This is a line with filter <a class="reference external" '
+ 'href="/admindocs/filters/#filtername">example filter</a></p>'
+ )
+ url = reverse("django-admindocs-models-detail", args=["admin_docs", "family"])
+ response = self.client.get(url)
+ self.assertContains(response, summary, html=True)
+ self.assertContains(response, body, html=True)
+
def test_model_detail_title(self):
self.assertContains(self.response, "<h1>admin_docs.Person</h1>", html=True)