def test_custom_email_subject(self): template_path = os.path.join(os.path.dirname(__file__), 'templates') with self.settings(TEMPLATE_DIRS=(template_path,)): data = {'email': '*****@*****.**'} 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')