summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-02-18 09:20:26 +0100
committerClaude Paroz <claude@2xlibre.net>2013-02-18 09:22:25 +0100
commit5ec0405a09c4b05b7ee6c58bf52a06290143d788 (patch)
treeb0652ccb121f7fc69a1424a35a7883d3421b19e8
parent9c2066d567492a4a285c053039f671a2ca4a23d4 (diff)
Fixed #19839 -- Isolated auth tests from customized TEMPLATE_LOADERS
Thanks limscoder for the report.
-rw-r--r--django/contrib/auth/tests/context_processors.py5
-rw-r--r--django/contrib/auth/tests/forms.py26
2 files changed, 18 insertions, 13 deletions
diff --git a/django/contrib/auth/tests/context_processors.py b/django/contrib/auth/tests/context_processors.py
index f846a828dd..9e56cfce85 100644
--- a/django/contrib/auth/tests/context_processors.py
+++ b/django/contrib/auth/tests/context_processors.py
@@ -63,9 +63,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'),
- ),
+ os.path.join(os.path.dirname(upath(__file__)), 'templates'),
+ ),
USE_TZ=False, # required for loading the fixture
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
)
diff --git a/django/contrib/auth/tests/forms.py b/django/contrib/auth/tests/forms.py
index 0c0973d543..c5a3fec7ce 100644
--- a/django/contrib/auth/tests/forms.py
+++ b/django/contrib/auth/tests/forms.py
@@ -341,18 +341,22 @@ class PasswordResetFormTest(TestCase):
self.assertTrue(form.is_valid())
self.assertEqual(form.cleaned_data['email'], email)
+ @override_settings(
+ TEMPLATE_LOADERS=('django.template.loaders.filesystem.Loader',),
+ TEMPLATE_DIRS=(
+ os.path.join(os.path.dirname(upath(__file__)), 'templates'),
+ ),
+ )
def test_custom_email_subject(self):
- template_path = os.path.join(os.path.dirname(upath(__file__)), 'templates')
- with self.settings(TEMPLATE_DIRS=(template_path,)):
- data = {'email': 'testclient@example.com'}
- form = PasswordResetForm(data)
- self.assertTrue(form.is_valid())
- # Since we're not providing a request object, we must provide a
- # domain_override to prevent the save operation from failing in the
- # potential case where contrib.sites is not installed. Refs #16412.
- form.save(domain_override='example.com')
- self.assertEqual(len(mail.outbox), 1)
- self.assertEqual(mail.outbox[0].subject, 'Custom password reset on example.com')
+ data = {'email': 'testclient@example.com'}
+ form = PasswordResetForm(data)
+ self.assertTrue(form.is_valid())
+ # Since we're not providing a request object, we must provide a
+ # domain_override to prevent the save operation from failing in the
+ # potential case where contrib.sites is not installed. Refs #16412.
+ form.save(domain_override='example.com')
+ self.assertEqual(len(mail.outbox), 1)
+ self.assertEqual(mail.outbox[0].subject, 'Custom password reset on example.com')
def test_bug_5605(self):
# bug #5605, preserve the case of the user name (before the @ in the