Permalink
Browse files

Added an explicit test that URL checks are recursive.

  • Loading branch information...
alasdairnicol authored and timgraham committed Apr 27, 2016
1 parent 8657386 commit ffb1c532ec3f01ce625d6e54fd1d63552693c895
@@ -10,6 +10,14 @@ def test_no_warnings(self):
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([])),
+ ])),
+]

0 comments on commit ffb1c53

Please sign in to comment.