From d776ccd87756e2c73a8ae290e7be00e6a0bafb41 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Tue, 24 Sep 2024 12:35:14 +0200 Subject: [PATCH 1/2] :test_tube: [#383] Test _zaak_url is populated --- .../openarchiefbeheer/destruction/tests/test_endpoints.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py b/backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py index 10ebbb39..959c486e 100644 --- a/backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py +++ b/backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py @@ -120,6 +120,12 @@ def test_create_destruction_list(self): self.assertEqual( items[1].zaak.url, "http://localhost:8003/zaken/api/v1/zaken/222-222-222" ) + self.assertEqual( + items[0]._zaak_url, "http://localhost:8003/zaken/api/v1/zaken/111-111-111" + ) + self.assertEqual( + items[1]._zaak_url, "http://localhost:8003/zaken/api/v1/zaken/222-222-222" + ) self.assertEqual(destruction_list.author, record_manager) From fb24d7f566064b3119ad5d15a7c8e4b0686ed428 Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Tue, 24 Sep 2024 12:35:47 +0200 Subject: [PATCH 2/2] :bug: [#383] Populate _zaak_url when creating items --- backend/src/openarchiefbeheer/destruction/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/openarchiefbeheer/destruction/models.py b/backend/src/openarchiefbeheer/destruction/models.py index bb00870e..ce42bb3d 100644 --- a/backend/src/openarchiefbeheer/destruction/models.py +++ b/backend/src/openarchiefbeheer/destruction/models.py @@ -125,7 +125,12 @@ def set_status(self, status: str) -> None: def add_items(self, zaken: Iterable["Zaak"]) -> list["DestructionListItem"]: return DestructionListItem.objects.bulk_create( - [DestructionListItem(destruction_list=self, zaak=zaak) for zaak in zaken] + [ + DestructionListItem( + destruction_list=self, zaak=zaak, _zaak_url=zaak.url + ) + for zaak in zaken + ] ) def get_author(self) -> "DestructionListAssignee":