Return client error status code for invalid form submissions (#849)

* Returns client error status code for invalid form submissions

* fix flaky test
This commit is contained in:
Sascha Ißbrücker
2024-09-23 20:30:49 +02:00
committed by GitHub
parent d4006026db
commit c3a2305a5f
7 changed files with 43 additions and 10 deletions

View File

@@ -43,6 +43,7 @@ class PasswordChangeViewTestCase(TestCase, BookmarkFactoryMixin):
response = self.client.post(reverse("change_password"), form_data)
self.assertEqual(response.status_code, 422)
self.assertIn("old_password", response.context_data["form"].errors)
def test_should_return_error_for_mismatching_new_password(self):
@@ -54,4 +55,5 @@ class PasswordChangeViewTestCase(TestCase, BookmarkFactoryMixin):
response = self.client.post(reverse("change_password"), form_data)
self.assertEqual(response.status_code, 422)
self.assertIn("new_password2", response.context_data["form"].errors)