def test_clean_password2_passwords_do_not_match(self): self.testdata['password2'] = 'test2345' form = UserCreationForm(data=self.testdata) self.assertFalse(form.is_valid()) self.assertEqual(len(form.errors['password2']), 1) self.assertEqual(form.errors['password2'], [PASSWORD_MISMATCH_ERROR])
def test_clean_password2_passwords_match(self): form = UserCreationForm(data=self.testdata) self.assertTrue(form.is_valid(), str(form.errors)) self.assertEqual(form.cleaned_data['password2'], 'test1234')