diff --git a/django/contrib/auth/tests/context_processors.py b/django/contrib/auth/tests/context_processors.py
index 49172c6..5b78ded 100644
a
|
b
|
|
1 | 1 | import os |
2 | 2 | |
3 | | from django.conf import settings |
| 3 | from django.conf import settings, global_settings |
4 | 4 | from django.contrib.auth import authenticate |
5 | 5 | from django.db.models import Q |
6 | 6 | from django.test import TestCase |
| 7 | from django.test.utils import override_settings |
7 | 8 | |
8 | 9 | |
9 | 10 | class AuthContextProcessorTests(TestCase): |
… |
… |
class AuthContextProcessorTests(TestCase):
|
13 | 14 | urls = 'django.contrib.auth.tests.urls' |
14 | 15 | fixtures = ['context-processors-users.xml'] |
15 | 16 | |
16 | | def setUp(self): |
17 | | self.old_TEMPLATE_DIRS = settings.TEMPLATE_DIRS |
18 | | settings.TEMPLATE_DIRS = ( |
19 | | os.path.join(os.path.dirname(__file__), 'templates'), |
20 | | ) |
21 | | |
22 | | def tearDown(self): |
23 | | settings.TEMPLATE_DIRS = self.old_TEMPLATE_DIRS |
24 | | |
| 17 | @override_settings( |
| 18 | MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES, |
| 19 | TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS, |
| 20 | ) |
25 | 21 | def test_session_not_accessed(self): |
26 | 22 | """ |
27 | 23 | Tests that the session is not accessed simply by including |
… |
… |
class AuthContextProcessorTests(TestCase):
|
30 | 26 | response = self.client.get('/auth_processor_no_attr_access/') |
31 | 27 | self.assertContains(response, "Session not accessed") |
32 | 28 | |
| 29 | @override_settings( |
| 30 | MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES, |
| 31 | TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS, |
| 32 | ) |
33 | 33 | def test_session_is_accessed(self): |
34 | 34 | """ |
35 | 35 | Tests that the session is accessed if the auth context processor |
… |
… |
class AuthContextProcessorTests(TestCase):
|
86 | 86 | # See bug #12060 |
87 | 87 | self.assertEqual(response.context['user'], user) |
88 | 88 | self.assertEqual(user, response.context['user']) |
| 89 | |
| 90 | AuthContextProcessorTests = override_settings( |
| 91 | TEMPLATE_DIRS = ( |
| 92 | os.path.join(os.path.dirname(__file__), 'templates'), |
| 93 | ) |
| 94 | )(AuthContextProcessorTests) |