custom_profile_fields: Make field_data optional during update.

This commit is contained in:
Shubham Padia
2024-01-20 13:18:26 +07:00
committed by Tim Abbott
parent c6c392bcc7
commit 137776b092
4 changed files with 55 additions and 14 deletions

View File

@@ -601,6 +601,17 @@ class UpdateCustomProfileFieldTest(CustomProfileFieldTestCase):
field.refresh_from_db()
self.assertEqual(field.hint, "")
field = CustomProfileField.objects.get(name="Favorite editor", realm=realm)
# Empty field_data should not be allowed
result = self.client_patch(
f"/json/realm/profile_fields/{field.id}",
info={
"field_data": {},
},
)
self.assert_json_error(result, "Field must have at least one choice.")
def test_update_is_aware_of_uniqueness(self) -> None:
self.login("iago")
realm = get_realm("zulip")