From c7f86d3eec84aeff83fc01f12990edb329ec2c4d Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 27 Oct 2016 22:58:41 +0200 Subject: Fixed #27373 -- Corrected 404 debug page message for an empty request path. --- tests/view_tests/tests/test_debug.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'tests') 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, "not-in-urls, 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) -- cgit v1.3