Skip to content

Commit

Permalink
Fixed #19839 -- Isolated auth tests from customized TEMPLATE_LOADERS
Browse files Browse the repository at this point in the history
Thanks limscoder for the report.
  • Loading branch information
claudep committed Feb 18, 2013
1 parent 9c2066d commit 5ec0405
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
5 changes: 3 additions & 2 deletions django/contrib/auth/tests/context_processors.py
Expand Up @@ -63,9 +63,10 @@ def test_permlookupdict_in(self):

@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',),
)
Expand Down
26 changes: 15 additions & 11 deletions django/contrib/auth/tests/forms.py
Expand Up @@ -341,18 +341,22 @@ def test_cleaned_data(self):
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
Expand Down

0 comments on commit 5ec0405

Please sign in to comment.