示例#1
0
文件: test_forms.py 项目: tgatz/opal
 def test_save(self):
     self.user.profile.force_password_change = True
     self.user.profile.save()
     self.assertEqual(True, self.user.profile.force_password_change)
     data = {
         'old_password' : 'password',
         'password1': 'abc123HHHH',
         'password2': 'abc123HHHH'
     }
     f = forms.ChangePasswordForm(self.user, data)
     self.assertTrue(f.is_valid())
     user = f.save()
     self.assertEqual(False, user.profile.force_password_change)
示例#2
0
文件: test_forms.py 项目: tgatz/opal
 def test_banned_password(self):
     f = forms.ChangePasswordForm(MagicMock(name='User'))
     f.cleaned_data = {'password1': 'password'}
     with self.assertRaises(forms.ValidationError):
         p = f.clean_password1()
示例#3
0
文件: test_forms.py 项目: tgatz/opal
 def test_clean_password(self):
     f = forms.ChangePasswordForm(MagicMock(name='User'))
     f.cleaned_data = {'password1': 'some valid password'}
     p = f.clean_password1()
     self.assertEqual('some valid password', p)