diff options
Diffstat (limited to 'tests/admin_docs/tests.py')
| -rw-r--r-- | tests/admin_docs/tests.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py index 82384a4bb8..f57a9c8117 100644 --- a/tests/admin_docs/tests.py +++ b/tests/admin_docs/tests.py @@ -9,6 +9,7 @@ from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings from django.test.utils import captured_stderr from django.urls import reverse +from django.utils import six from .models import Company, Person @@ -82,6 +83,18 @@ class AdminDocViewTests(TestDataMixin, AdminDocsTestCase): self.assertContains(response, 'Views by namespace test') self.assertContains(response, 'Name: <code>test:func</code>.') + @unittest.skipIf(six.PY2, "Python 2 doesn't support __qualname__.") + def test_view_index_with_method(self): + """ + Views that are methods are listed correctly. + """ + response = self.client.get(reverse('django-admindocs-views-index')) + self.assertContains( + response, + '<h3><a href="/admindocs/views/django.contrib.admin.sites.AdminSite.index/">/admin/</a></h3>', + html=True + ) + def test_view_detail(self): url = reverse('django-admindocs-views-detail', args=['django.contrib.admindocs.views.BaseAdminDocsView']) response = self.client.get(url) @@ -103,6 +116,14 @@ class AdminDocViewTests(TestDataMixin, AdminDocsTestCase): self.assertEqual(response.status_code, 404) self.assertNotIn("urlpatterns_reverse.nonimported_module", sys.modules) + def test_view_detail_as_method(self): + """ + Views that are methods can be displayed. + """ + url = reverse('django-admindocs-views-detail', args=['django.contrib.admin.sites.AdminSite.index']) + response = self.client.get(url) + self.assertEqual(response.status_code, 200 if six.PY3 else 404) + def test_model_index(self): response = self.client.get(reverse('django-admindocs-models-index')) self.assertContains( |
