summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPreston Holmes <preston@ptone.com>2013-04-05 08:43:22 -0700
committerPreston Holmes <preston@ptone.com>2013-04-05 09:03:28 -0700
commita49e7dd2a34882fc68244e024eb2876b21c7e8a8 (patch)
tree529f4d9a92606a74fdcd6e0ecc5dd147dbe8f6e9
parent975c5afdb5a0c2f9f61f9faecf8dbd928c4996b7 (diff)
Fixed #20114 -- support custom project login_url in tests
Thanks to Matias Bordese for the patch
-rw-r--r--django/contrib/auth/tests/test_decorators.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/contrib/auth/tests/test_decorators.py b/django/contrib/auth/tests/test_decorators.py
index a53dcd5bb7..6d6d335354 100644
--- a/django/contrib/auth/tests/test_decorators.py
+++ b/django/contrib/auth/tests/test_decorators.py
@@ -1,3 +1,4 @@
+from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tests.test_views import AuthViewsTestCase
from django.contrib.auth.tests.utils import skipIfCustomUser
@@ -27,11 +28,13 @@ class LoginRequiredTestCase(AuthViewsTestCase):
pass
login_required(normal_view)
- def testLoginRequired(self, view_url='/login_required/', login_url='/login/'):
+ def testLoginRequired(self, view_url='/login_required/', login_url=None):
"""
Check that login_required works on a simple view wrapped in a
login_required decorator.
"""
+ if login_url is None:
+ login_url = settings.LOGIN_URL
response = self.client.get(view_url)
self.assertEqual(response.status_code, 302)
self.assertTrue(login_url in response.url)