Skip to content

Commit

Permalink
✅ [#87] Test retrieving non-existent zaak
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Jan 18, 2022
1 parent f859306 commit 6a5b653
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/archiefbeheercomponent/destruction/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,30 @@ def test_zaakafhandelcomponent_link(self, m):
self.assertEqual(
"http://example.nl/987654321/ZAAK-002/uuid-2", zaak_2_data["zac_link"]
)

def test_retrieve_missing_zaak(self, m):
self._set_up_services()
self._set_up_mocks(m)

user = UserFactory.create(
username="user",
password="user",
email="[email protected]",
role__can_start_destruction=True,
role__can_review_destruction=True,
)

destruction_list = DestructionListFactory.create(author=user, assignee=user)
missing_zaak_url = f"{ZAKEN_ROOT}zaken/uuid-3"
DestructionListItemFactory.create(
destruction_list=destruction_list, zaak=missing_zaak_url
)
m.get(missing_zaak_url, status_code=404)

url = reverse("destruction:fetch-list-items", args=[destruction_list.id])

self.client.force_login(user)
response = self.client.get(url)

self.assertEqual(200, response.status_code)
self.assertIn("error", response.json())

0 comments on commit 6a5b653

Please sign in to comment.