1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

[1.1.X] Fixed #12594 -- Ensured that a meaningful exception is raised when the urlconf_module is None. Thanks to buriy for the report and patch.

Backport of r12854 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12855 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee
2010-03-26 15:15:55 +00:00
parent 917fb7c993
commit 7733895382
3 changed files with 21 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ ImproperlyConfigured: The included urlconf regressiontests.urlpatterns_reverse.n
import unittest
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse, resolve, NoReverseMatch, Resolver404
from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect
from django.shortcuts import redirect
@@ -276,3 +277,16 @@ class RequestURLconfTests(TestCase):
response = self.client.get('/second_test/')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, 'outer:,inner:/second_test/')
def test_urlconf_overridden_with_null(self):
settings.MIDDLEWARE_CLASSES += (
'%s.NullChangeURLconfMiddleware' % middleware.__name__,
)
self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')
class NoRootUrlConfTests(TestCase):
"""Tests for handler404 and handler500 if urlconf is None"""
urls = None
def test_no_handler_exception(self):
self.assertRaises(ImproperlyConfigured, self.client.get, '/test/me/')