Ejemplo n.º 1
0
 def test_success(self):
     user = User.objects.get(username='******')
     data = {
         'new_password1': 'abc123',
         'new_password2': 'abc123',
         }
     form = SetPasswordForm(user, data)
     self.assertTrue(form.is_valid())
Ejemplo n.º 2
0
 def test_password_verification(self):
     # The two new passwords do not match.
     user = User.objects.get(username='******')
     data = {
         'new_password1': 'abc123',
         'new_password2': 'abc',
         }
     form = SetPasswordForm(user, data)
     self.assertFalse(form.is_valid())
     self.assertEqual(form["new_password2"].errors,
                      [u"The two password fields didn't match."])