Fixed #19839 -- Isolated auth tests from customized TEMPLATE_LOADERS
Thanks limscoder for the report.
This commit is contained in:
parent
9c2066d567
commit
5ec0405a09
|
@ -63,9 +63,10 @@ class PermWrapperTests(TestCase):
|
||||||
|
|
||||||
@skipIfCustomUser
|
@skipIfCustomUser
|
||||||
@override_settings(
|
@override_settings(
|
||||||
|
TEMPLATE_LOADERS=('django.template.loaders.filesystem.Loader',),
|
||||||
TEMPLATE_DIRS=(
|
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
|
USE_TZ=False, # required for loading the fixture
|
||||||
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',),
|
||||||
)
|
)
|
||||||
|
|
|
@ -341,18 +341,22 @@ class PasswordResetFormTest(TestCase):
|
||||||
self.assertTrue(form.is_valid())
|
self.assertTrue(form.is_valid())
|
||||||
self.assertEqual(form.cleaned_data['email'], email)
|
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):
|
def test_custom_email_subject(self):
|
||||||
template_path = os.path.join(os.path.dirname(upath(__file__)), 'templates')
|
data = {'email': 'testclient@example.com'}
|
||||||
with self.settings(TEMPLATE_DIRS=(template_path,)):
|
form = PasswordResetForm(data)
|
||||||
data = {'email': 'testclient@example.com'}
|
self.assertTrue(form.is_valid())
|
||||||
form = PasswordResetForm(data)
|
# Since we're not providing a request object, we must provide a
|
||||||
self.assertTrue(form.is_valid())
|
# domain_override to prevent the save operation from failing in the
|
||||||
# Since we're not providing a request object, we must provide a
|
# potential case where contrib.sites is not installed. Refs #16412.
|
||||||
# domain_override to prevent the save operation from failing in the
|
form.save(domain_override='example.com')
|
||||||
# potential case where contrib.sites is not installed. Refs #16412.
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
form.save(domain_override='example.com')
|
self.assertEqual(mail.outbox[0].subject, 'Custom password reset on 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):
|
def test_bug_5605(self):
|
||||||
# bug #5605, preserve the case of the user name (before the @ in the
|
# bug #5605, preserve the case of the user name (before the @ in the
|
||||||
|
|
Loading…
Reference in New Issue