Skip to content

Commit d68f9fd

Browse files
SilviaAmAmsvenvandescheur
authored andcommitted
🧪 [#303] Test retrieving zaaktypen with empty id and destruction list filter
1 parent c3871b3 commit d68f9fd

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

backend/src/openarchiefbeheer/zaken/tests/test_views.py

+25
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from unittest.mock import patch
22

33
from django.core.cache import cache
4+
from django.test import tag
45
from django.utils.translation import gettext_lazy as _
56

67
from furl import furl
@@ -265,6 +266,30 @@ def test_retrieve_zaaktypen_choices_for_destruction_list(self):
265266

266267
self.assertEqual(choices[1]["value"], items_in_list[2].zaak.zaaktype)
267268

269+
@tag("gh-303")
270+
def test_retrieve_zaaktypen_choices_for_destruction_list_if_zaaktype_id_empty(self):
271+
user = UserFactory.create(role__can_start_destruction=True)
272+
273+
item = DestructionListItemFactory.create(
274+
with_zaak=True,
275+
zaak__with_expand=True,
276+
status=ListItemStatus.suggested,
277+
)
278+
item.zaak._expand["zaaktype"]["identificatie"] = ""
279+
item.zaak.save()
280+
281+
self.client.force_authenticate(user=user)
282+
endpoint = furl(reverse("api:retrieve-zaaktypen-choices"))
283+
endpoint.args["destruction_list"] = item.destruction_list.uuid
284+
285+
response = self.client.get(endpoint.url)
286+
287+
self.assertEqual(response.status_code, status.HTTP_200_OK)
288+
289+
choices = response.json()
290+
291+
self.assertEqual(choices[0]["label"], _("(no identificatie)"))
292+
268293
@Mocker()
269294
def test_not_cached_if_query_param_chages(self, m):
270295
user = UserFactory.create(role__can_start_destruction=True)

0 commit comments

Comments
 (0)