diff options
| author | Alasdair Nicol <alasdair@thenicols.net> | 2015-09-21 18:45:56 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-09-21 20:10:33 -0400 |
| commit | f2975c021d247bf8c6a5fc23988639c636da86f5 (patch) | |
| tree | 88fa1c3d4d345acd257809becec570e8d94b84c9 /tests/check_framework | |
| parent | 392f64842f678b6e29a2e5fac65a586d9c9a57ff (diff) | |
Refs #23813 -- Moved URLconfs into module and tidied docstrings.
Diffstat (limited to 'tests/check_framework')
| -rw-r--r-- | tests/check_framework/test_urls.py | 14 | ||||
| -rw-r--r-- | tests/check_framework/urls/__init__.py | 0 | ||||
| -rw-r--r-- | tests/check_framework/urls/beginning_with_slash.py | 7 | ||||
| -rw-r--r-- | tests/check_framework/urls/include_with_dollar.py (renamed from tests/check_framework/urls_include.py) | 0 | ||||
| -rw-r--r-- | tests/check_framework/urls/name_with_colon.py | 7 | ||||
| -rw-r--r-- | tests/check_framework/urls/no_warnings.py | 9 | ||||
| -rw-r--r-- | tests/check_framework/urls_name.py | 13 | ||||
| -rw-r--r-- | tests/check_framework/urls_no_warnings.py | 15 | ||||
| -rw-r--r-- | tests/check_framework/urls_slash.py | 13 |
9 files changed, 30 insertions, 48 deletions
diff --git a/tests/check_framework/test_urls.py b/tests/check_framework/test_urls.py index 2a05146e77..19f2d2990e 100644 --- a/tests/check_framework/test_urls.py +++ b/tests/check_framework/test_urls.py @@ -4,12 +4,12 @@ from django.test.utils import override_settings class CheckUrlsTest(SimpleTestCase): - @override_settings(ROOT_URLCONF='check_framework.urls_no_warnings') - def test_include_no_warnings(self): + @override_settings(ROOT_URLCONF='check_framework.urls.no_warnings') + def test_no_warnings(self): result = check_url_config(None) self.assertEqual(result, []) - @override_settings(ROOT_URLCONF='check_framework.urls_include') + @override_settings(ROOT_URLCONF='check_framework.urls.include_with_dollar') def test_include_with_dollar(self): result = check_url_config(None) self.assertEqual(len(result), 1) @@ -18,8 +18,8 @@ class CheckUrlsTest(SimpleTestCase): expected_msg = "Your URL pattern '^include-with-dollar$' uses include with a regex ending with a '$'." self.assertIn(expected_msg, warning.msg) - @override_settings(ROOT_URLCONF='check_framework.urls_slash') - def test_url_beginning_with_slash(self): + @override_settings(ROOT_URLCONF='check_framework.urls.beginning_with_slash') + def test_beginning_with_slash(self): result = check_url_config(None) self.assertEqual(len(result), 1) warning = result[0] @@ -27,8 +27,8 @@ class CheckUrlsTest(SimpleTestCase): expected_msg = "Your URL pattern '/starting-with-slash/$' has a regex beginning with a '/'" self.assertIn(expected_msg, warning.msg) - @override_settings(ROOT_URLCONF='check_framework.urls_name') - def test_url_pattern_name_with_colon(self): + @override_settings(ROOT_URLCONF='check_framework.urls.name_with_colon') + def test_name_with_colon(self): result = check_url_config(None) self.assertEqual(len(result), 1) warning = result[0] diff --git a/tests/check_framework/urls/__init__.py b/tests/check_framework/urls/__init__.py new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/tests/check_framework/urls/__init__.py diff --git a/tests/check_framework/urls/beginning_with_slash.py b/tests/check_framework/urls/beginning_with_slash.py new file mode 100644 index 0000000000..859f0987d6 --- /dev/null +++ b/tests/check_framework/urls/beginning_with_slash.py @@ -0,0 +1,7 @@ +from django.conf.urls import include, url + +urlpatterns = [ + url('^', include([ + url(r'/starting-with-slash/$', lambda x: x), + ])), +] diff --git a/tests/check_framework/urls_include.py b/tests/check_framework/urls/include_with_dollar.py index 5bb94c9688..5bb94c9688 100644 --- a/tests/check_framework/urls_include.py +++ b/tests/check_framework/urls/include_with_dollar.py diff --git a/tests/check_framework/urls/name_with_colon.py b/tests/check_framework/urls/name_with_colon.py new file mode 100644 index 0000000000..e761035ee1 --- /dev/null +++ b/tests/check_framework/urls/name_with_colon.py @@ -0,0 +1,7 @@ +from django.conf.urls import include, url + +urlpatterns = [ + url('^', include([ + url(r'^$', lambda x: x, name='name_with:colon'), + ])), +] diff --git a/tests/check_framework/urls/no_warnings.py b/tests/check_framework/urls/no_warnings.py new file mode 100644 index 0000000000..773ad27ef1 --- /dev/null +++ b/tests/check_framework/urls/no_warnings.py @@ -0,0 +1,9 @@ +from django.conf.urls import include, url + +urlpatterns = [ + url(r'^foo/', lambda x: x, name='foo'), + # This dollar is ok as it is escaped + url(r'^\$', include([ + url(r'^bar/$', lambda x: x, name='bar'), + ])), +] diff --git a/tests/check_framework/urls_name.py b/tests/check_framework/urls_name.py deleted file mode 100644 index 9662532851..0000000000 --- a/tests/check_framework/urls_name.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.conf.urls import include, url -from django.http import HttpResponse - - -def view(request): - return HttpResponse('') - - -urlpatterns = [ - url('^', include([ - url(r'^$', view, name='name_with:colon'), - ])), -] diff --git a/tests/check_framework/urls_no_warnings.py b/tests/check_framework/urls_no_warnings.py deleted file mode 100644 index 657306f1ef..0000000000 --- a/tests/check_framework/urls_no_warnings.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.conf.urls import include, url -from django.http import HttpResponse - - -def view(request): - return HttpResponse('') - - -urlpatterns = [ - url(r'^foo/', view, name='foo'), - # This dollar is ok as it is escaped - url(r'^\$', include([ - url(r'^bar/$', view, name='bar'), - ])), -] diff --git a/tests/check_framework/urls_slash.py b/tests/check_framework/urls_slash.py deleted file mode 100644 index 474f6293d5..0000000000 --- a/tests/check_framework/urls_slash.py +++ /dev/null @@ -1,13 +0,0 @@ -from django.conf.urls import include, url -from django.http import HttpResponse - - -def view(request): - return HttpResponse('') - - -urlpatterns = [ - url('^', include([ - url(r'/starting-with-slash/$', view), - ])), -] |
