summaryrefslogtreecommitdiff
path: root/tests/admin_docs
diff options
context:
space:
mode:
authorMarkus Holtermann <info@markusholtermann.eu>2014-10-04 19:04:21 +0200
committerTim Graham <timograham@gmail.com>2014-10-06 13:44:01 -0400
commitc2508990cb53b52783ebb38dc0b5f0ab5d023c76 (patch)
treeddc2bdab52a3da0afcb90af9d06317c3370524c9 /tests/admin_docs
parentb3569b3a825e82d25ffadf49f436c13f30a205f8 (diff)
[1.7.x] Fixed #23601 -- Ensured view exists in URLconf before importing it in admindocs.
Backport of 2f16ff5a6c from master
Diffstat (limited to 'tests/admin_docs')
-rw-r--r--tests/admin_docs/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index 93e49e0eb5..5808d91a95 100644
--- a/tests/admin_docs/tests.py
+++ b/tests/admin_docs/tests.py
@@ -1,3 +1,4 @@
+import sys
import unittest
from django.conf import settings
@@ -79,6 +80,16 @@ class AdminDocViewTests(TestCase):
# View docstring
self.assertContains(response, 'Base view for admindocs views.')
+ def test_view_detail_illegal_import(self):
+ """
+ #23601 - Ensure the view exists in the URLconf.
+ """
+ response = self.client.get(
+ reverse('django-admindocs-views-detail',
+ args=['urlpatterns_reverse.nonimported_module.view']))
+ self.assertEqual(response.status_code, 404)
+ self.assertNotIn("urlpatterns_reverse.nonimported_module", sys.modules)
+
def test_model_index(self):
response = self.client.get(reverse('django-admindocs-models-index'))
self.assertContains(