1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Removed some direct settings manipulations in tests; refs #21230.

This commit is contained in:
Bouke Haarsma
2013-10-14 15:14:17 +02:00
committed by Tim Graham
parent 499cd912ca
commit 3565efaa45
16 changed files with 137 additions and 223 deletions

View File

@@ -467,17 +467,11 @@ class ClientTest(TestCase):
self.assertEqual(mail.outbox[1].to[0], 'second@example.com')
self.assertEqual(mail.outbox[1].to[1], 'third@example.com')
@override_settings(
MIDDLEWARE_CLASSES = ('django.middleware.csrf.CsrfViewMiddleware',)
)
class CSRFEnabledClientTests(TestCase):
def setUp(self):
# Enable the CSRF middleware for this test
self.old_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES
csrf_middleware_class = 'django.middleware.csrf.CsrfViewMiddleware'
if csrf_middleware_class not in settings.MIDDLEWARE_CLASSES:
settings.MIDDLEWARE_CLASSES += (csrf_middleware_class,)
def tearDown(self):
settings.MIDDLEWARE_CLASSES = self.old_MIDDLEWARE_CLASSES
def test_csrf_enabled_client(self):
"A client can be instantiated with CSRF checks enabled"
csrf_client = Client(enforce_csrf_checks=True)