def test_change_password_empty_new_password(self): m_data = { 'user': self.user_profile.user } self.form_data['new_password'] = '******' form = UserPasswordChangeForm(data=self.form_data, **m_data) self.assertFalse(form.is_valid())
def test_change_password_passwords_dont_match(self): m_data = { 'user': self.user_profile.user } self.form_data['new_password'] = '******' self.form_data['confirm_password'] = '******' form = UserPasswordChangeForm(data=self.form_data, **m_data) self.assertFalse(form.is_valid())
def test_change_password_common_case(self): m_data = { 'user': self.user_profile.user } form = UserPasswordChangeForm(data=self.form_data, **m_data) self.assertTrue(form.is_valid()) form.save() self.assertTrue(self.user_profile.user.check_password( self.form_data.get('new_password')))