Added an explicit test that URL checks are recursive.
This commit is contained in:
parent
86573861a9
commit
ffb1c532ec
|
@ -10,6 +10,14 @@ class CheckUrlsTest(SimpleTestCase):
|
|||
result = check_url_config(None)
|
||||
self.assertEqual(result, [])
|
||||
|
||||
@override_settings(ROOT_URLCONF='check_framework.urls.warning_in_include')
|
||||
def test_check_resolver_recursive(self):
|
||||
# The resolver is checked recursively (examining url()s in include()).
|
||||
result = check_url_config(None)
|
||||
self.assertEqual(len(result), 1)
|
||||
warning = result[0]
|
||||
self.assertEqual(warning.id, 'urls.W001')
|
||||
|
||||
@override_settings(ROOT_URLCONF='check_framework.urls.include_with_dollar')
|
||||
def test_include_with_dollar(self):
|
||||
result = check_url_config(None)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import url
|
||||
|
||||
urlpatterns = [
|
||||
url('^', include([
|
||||
url(r'/starting-with-slash/$', lambda x: x),
|
||||
])),
|
||||
url(r'/starting-with-slash/$', lambda x: x),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include([
|
||||
url(r'^include-with-dollar$', include([])),
|
||||
])),
|
||||
url(r'^include-with-dollar$', include([])),
|
||||
]
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
from django.conf.urls import include, url
|
||||
from django.conf.urls import url
|
||||
|
||||
urlpatterns = [
|
||||
url('^', include([
|
||||
url(r'^$', lambda x: x, name='name_with:colon'),
|
||||
])),
|
||||
url(r'^$', lambda x: x, name='name_with:colon'),
|
||||
]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
from django.conf.urls import include, url
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^', include([
|
||||
url(r'^include-with-dollar$', include([])),
|
||||
])),
|
||||
]
|
Loading…
Reference in New Issue