예제 #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())
예제 #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,
                      [force_text(form.error_messages['password_mismatch'])])