summaryrefslogtreecommitdiff
path: root/tests/check_framework
diff options
context:
space:
mode:
authorAlasdair Nicol <alasdair@thenicols.net>2016-04-27 22:38:00 +0100
committerTim Graham <timograham@gmail.com>2016-04-29 07:38:57 -0400
commitffb1c532ec3f01ce625d6e54fd1d63552693c895 (patch)
tree103293ab45b60cb1a59cc4890ebcc97354f40ac3 /tests/check_framework
parent86573861a95e5a47dc7ff906443117d75b73dca1 (diff)
Added an explicit test that URL checks are recursive.
Diffstat (limited to 'tests/check_framework')
-rw-r--r--tests/check_framework/test_urls.py8
-rw-r--r--tests/check_framework/urls/beginning_with_slash.py6
-rw-r--r--tests/check_framework/urls/include_with_dollar.py4
-rw-r--r--tests/check_framework/urls/name_with_colon.py6
-rw-r--r--tests/check_framework/urls/warning_in_include.py7
5 files changed, 20 insertions, 11 deletions
diff --git a/tests/check_framework/test_urls.py b/tests/check_framework/test_urls.py
index 7fe13c9c40..a0c113aac3 100644
--- a/tests/check_framework/test_urls.py
+++ b/tests/check_framework/test_urls.py
@@ -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)
diff --git a/tests/check_framework/urls/beginning_with_slash.py b/tests/check_framework/urls/beginning_with_slash.py
index 859f0987d6..736e91820e 100644
--- a/tests/check_framework/urls/beginning_with_slash.py
+++ b/tests/check_framework/urls/beginning_with_slash.py
@@ -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),
]
diff --git a/tests/check_framework/urls/include_with_dollar.py b/tests/check_framework/urls/include_with_dollar.py
index 5bb94c9688..3d4a55b41f 100644
--- a/tests/check_framework/urls/include_with_dollar.py
+++ b/tests/check_framework/urls/include_with_dollar.py
@@ -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([])),
]
diff --git a/tests/check_framework/urls/name_with_colon.py b/tests/check_framework/urls/name_with_colon.py
index e761035ee1..f7bc0c18b4 100644
--- a/tests/check_framework/urls/name_with_colon.py
+++ b/tests/check_framework/urls/name_with_colon.py
@@ -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'),
]
diff --git a/tests/check_framework/urls/warning_in_include.py b/tests/check_framework/urls/warning_in_include.py
new file mode 100644
index 0000000000..5bb94c9688
--- /dev/null
+++ b/tests/check_framework/urls/warning_in_include.py
@@ -0,0 +1,7 @@
+from django.conf.urls import include, url
+
+urlpatterns = [
+ url(r'^', include([
+ url(r'^include-with-dollar$', include([])),
+ ])),
+]