Beispiel #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?"]})
Beispiel #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)
Beispiel #3
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)
Beispiel #4
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())
Beispiel #5
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())
Beispiel #6
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?"
             ]
         })
Beispiel #7
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.'])
Beispiel #8
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.'])