diff --git a/arkindex/users/tests/test_registration.py b/arkindex/users/tests/test_registration.py index b934db8ef830210e033263e287930b09e0646aa3..ccf8c617fb0ccfe1f667c46189156112ae39b77b 100644 --- a/arkindex/users/tests/test_registration.py +++ b/arkindex/users/tests/test_registration.py @@ -64,6 +64,22 @@ class TestRegistration(FixtureAPITestCase): ) self.assertEqual(response.status_code, status.HTTP_200_OK) + def test_update_password_validation(self): + self.client.force_login(self.user) + response = self.client.patch( + reverse("api:user-retrieve"), + data={"password": "email"}, + format="json", + ) + self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) + self.assertDictEqual(response.json(), { + "password": [ + "The password is too similar to the email address.", + "This password is too short. It must contain at least 8 characters.", + "This password is too common.", + ] + }) + def test_update_display_name(self): self.client.force_login(self.user) response = self.client.patch(