diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2016-10-27 22:58:41 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-10-27 16:58:41 -0400 |
| commit | c7f86d3eec84aeff83fc01f12990edb329ec2c4d (patch) | |
| tree | 2b3d6d284424cb8636c3dd78626cde3d9895c7b3 /tests | |
| parent | 968f61b99180a17e1752432df38f28f192c6cf86 (diff) | |
Fixed #27373 -- Corrected 404 debug page message for an empty request path.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/view_tests/tests/test_debug.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py index ba6e6defee..44a6a360e4 100644 --- a/tests/view_tests/tests/test_debug.py +++ b/tests/view_tests/tests/test_debug.py @@ -11,6 +11,7 @@ import sys import tempfile from unittest import skipIf +from django.conf.urls import url from django.core import mail from django.core.files.uploadedfile import SimpleUploadedFile from django.db import DatabaseError, connection @@ -28,9 +29,10 @@ from django.views.debug import ( from .. import BrokenException, except_args from ..views import ( - custom_exception_reporter_filter_view, multivalue_dict_key_error, - non_sensitive_view, paranoid_view, sensitive_args_function_caller, - sensitive_kwargs_function_caller, sensitive_method_view, sensitive_view, + custom_exception_reporter_filter_view, index_page, + multivalue_dict_key_error, non_sensitive_view, paranoid_view, + sensitive_args_function_caller, sensitive_kwargs_function_caller, + sensitive_method_view, sensitive_view, ) if six.PY3: @@ -44,6 +46,10 @@ class User(object): return 'jacob' +class WithoutEmptyPathUrls: + urlpatterns = [url(r'url/$', index_page, name='url')] + + class CallableSettingWrapperTests(SimpleTestCase): """ Unittests for CallableSettingWrapper """ @@ -115,6 +121,11 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase): self.assertNotContains(response, "Raised by:", status_code=404) self.assertContains(response, "<code>not-in-urls</code>, didn't match", status_code=404) + @override_settings(ROOT_URLCONF=WithoutEmptyPathUrls) + def test_404_empty_path_not_in_urls(self): + response = self.client.get('/') + self.assertContains(response, "The empty path didn't match any of these.", status_code=404) + def test_technical_404(self): response = self.client.get('/views/technical404/') self.assertContains(response, "Raised by:", status_code=404) |
