示例#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_success(self):
     user = User.objects.get(username='******')
     data = {
         'new_password1': 'abc123',
         'new_password2': 'abc123',
         }
     form = SetPasswordForm(user, data)
     self.assertTrue(form.is_valid())
示例#3
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_unicode(form.error_messages['password_mismatch'])])
示例#4
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_unicode(form.error_messages['password_mismatch'])])