mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #23601 -- Ensured view exists in URLconf before importing it in admindocs.
This commit is contained in:
committed by
Tim Graham
parent
a24cf21722
commit
2f16ff5a6c
@@ -1,3 +1,4 @@
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from django.conf import settings
|
||||
@@ -84,6 +85,16 @@ class AdminDocViewTests(AdminDocsTestCase):
|
||||
# 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(
|
||||
|
||||
Reference in New Issue
Block a user