summaryrefslogtreecommitdiff
path: root/django/contrib/auth/tests/test_context_processors.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-12-17 22:10:57 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-12-28 17:02:30 +0100
commitcf0fd65ed42d5d4f0585da413db4b1cf7c6b0d1a (patch)
tree3f4f652525adf16178018e4ce0c7eddeb0f61360 /django/contrib/auth/tests/test_context_processors.py
parentd3a982556d655adcf4ba331d2def685d8249170f (diff)
Deprecated TEMPLATE_LOADERS.
Diffstat (limited to 'django/contrib/auth/tests/test_context_processors.py')
-rw-r--r--django/contrib/auth/tests/test_context_processors.py32
1 files changed, 7 insertions, 25 deletions
diff --git a/django/contrib/auth/tests/test_context_processors.py b/django/contrib/auth/tests/test_context_processors.py
index cb96bf5d6d..f96eac9db7 100644
--- a/django/contrib/auth/tests/test_context_processors.py
+++ b/django/contrib/auth/tests/test_context_processors.py
@@ -1,13 +1,12 @@
-import os
-
from django.contrib.auth import authenticate
-from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.models import User, Permission
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.context_processors import PermWrapper, PermLookupDict
from django.db.models import Q
from django.test import TestCase, override_settings
-from django.utils._os import upath
+
+from .settings import AUTH_MIDDLEWARE_CLASSES, AUTH_TEMPLATES
+from .utils import skipIfCustomUser
class MockUser(object):
@@ -61,17 +60,10 @@ class PermWrapperTests(TestCase):
@skipIfCustomUser
@override_settings(
- TEMPLATE_LOADERS=('django.template.loaders.filesystem.Loader',),
- TEMPLATE_DIRS=(
- os.path.join(os.path.dirname(upath(__file__)), 'templates'),
- ),
- TEMPLATE_CONTEXT_PROCESSORS=(
- 'django.contrib.auth.context_processors.auth',
- 'django.contrib.messages.context_processors.messages'
- ),
+ PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
ROOT_URLCONF='django.contrib.auth.tests.urls',
+ TEMPLATES=AUTH_TEMPLATES,
USE_TZ=False, # required for loading the fixture
- PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
)
class AuthContextProcessorTests(TestCase):
"""
@@ -79,12 +71,7 @@ class AuthContextProcessorTests(TestCase):
"""
fixtures = ['context-processors-users.xml']
- @override_settings(
- MIDDLEWARE_CLASSES=(
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- ),
- )
+ @override_settings(MIDDLEWARE_CLASSES=AUTH_MIDDLEWARE_CLASSES)
def test_session_not_accessed(self):
"""
Tests that the session is not accessed simply by including
@@ -93,12 +80,7 @@ class AuthContextProcessorTests(TestCase):
response = self.client.get('/auth_processor_no_attr_access/')
self.assertContains(response, "Session not accessed")
- @override_settings(
- MIDDLEWARE_CLASSES=(
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- ),
- )
+ @override_settings(MIDDLEWARE_CLASSES=AUTH_MIDDLEWARE_CLASSES)
def test_session_is_accessed(self):
"""
Tests that the session is accessed if the auth context processor