Skip to content

Commit ec7e66d

Browse files
Viicossergei-maertens
authored andcommittedJul 3, 2024
[#4414] Update validation of IOT endpoint
1 parent d8bef35 commit ec7e66d

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎src/openforms/registrations/api/filters.py

+7
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ def validate(self, attrs: dict[str, Any]) -> dict[str, Any]:
5050
)
5151
)
5252

53+
if registration_backend == "zgw-create-zaak" and "zgw_api_group" not in attrs:
54+
raise serializers.ValidationError(
55+
_(
56+
"'zgw_api_group' is required when 'registration_backend' is set to 'zgw-create-zaak'."
57+
)
58+
)
59+
5360
return attrs
5461

5562
def get_fields(self):

‎src/openforms/registrations/tests/test_views.py

+10
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ def test_filter_with_invalid_zgw_group(self, m):
150150

151151
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
152152

153+
def test_missing_zgw_api_group(self, m):
154+
user = StaffUserFactory.create()
155+
url = furl(reverse("api:iotypen-list"))
156+
url.args["registration_backend"] = "zgw-create-zaak"
157+
self.client.force_login(user)
158+
159+
response = self.client.get(url.url)
160+
161+
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
162+
153163
def test_missing_objects_api_group(self, m):
154164
user = StaffUserFactory.create()
155165
url = furl(reverse("api:iotypen-list"))

0 commit comments

Comments
 (0)
Failed to load comments.