Exemplo n.º 1
0
 def test_nonexistant_email(self):
     # Test nonexistant email address
     data = {'email':'*****@*****.**'}
     form = PasswordResetForm(data)
     self.assertFalse(form.is_valid())
     self.assertEqual(form.errors,
                      {'email': [u"That e-mail address doesn't have an associated user account. Are you sure you've registered?"]})
Exemplo n.º 2
0
 def test_cleaned_data(self):
     # Regression test
     (user, username, email) = self.create_dummy_user()
     data = {'email': email}
     form = PasswordResetForm(data)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.cleaned_data['email'], email)
Exemplo n.º 3
0
 def test_inactive_user(self):
     #tests that inactive user cannot
     #receive password reset email
     (user, username, email) = self.create_dummy_user()
     user.is_active = False
     user.save()
     form = PasswordResetForm({'email': email})
     self.assertFalse(form.is_valid())
Exemplo n.º 4
0
 def test_invalid_email(self):
     data = {'email':'not valid'}
     form = PasswordResetForm(data)
     self.assertFalse(form.is_valid())
     self.assertEqual(form['email'].errors,
                      [u'Enter a valid e-mail address.'])