|
| 1 | +from django.test import tag |
| 2 | + |
| 3 | +from furl import furl |
1 | 4 | from rest_framework import status
|
2 | 5 | from rest_framework.reverse import reverse
|
3 | 6 | from rest_framework.test import APITestCase
|
4 | 7 |
|
5 | 8 | from openarchiefbeheer.accounts.tests.factories import UserFactory
|
| 9 | +from openarchiefbeheer.destruction.constants import InternalStatus, ListItemStatus |
| 10 | +from openarchiefbeheer.destruction.tests.factories import DestructionListItemFactory |
6 | 11 |
|
7 | 12 | from .factories import ZaakFactory
|
8 | 13 |
|
@@ -49,3 +54,25 @@ def test_retrieve_all_zaken_as_reviewer(self):
|
49 | 54 |
|
50 | 55 | self.assertEqual(response.status_code, status.HTTP_200_OK)
|
51 | 56 | self.assertEqual(data["count"], 4)
|
| 57 | + |
| 58 | + @tag("gh-328") |
| 59 | + def test_retrieve_all_zaken_with_removed_zaken(self): |
| 60 | + ZaakFactory.create_batch(5) |
| 61 | + # A deleted item |
| 62 | + DestructionListItemFactory.create( |
| 63 | + zaak=None, |
| 64 | + status=ListItemStatus.suggested, |
| 65 | + processing_status=InternalStatus.succeeded, |
| 66 | + ) |
| 67 | + |
| 68 | + user = UserFactory(username="record_manager", role__can_start_destruction=True) |
| 69 | + |
| 70 | + self.client.force_authenticate(user) |
| 71 | + |
| 72 | + endpoint = furl(reverse("api:zaken-list")) |
| 73 | + endpoint.args["not_in_destruction_list"] = True |
| 74 | + response = self.client.get(endpoint.url) |
| 75 | + data = response.json() |
| 76 | + |
| 77 | + self.assertEqual(response.status_code, status.HTTP_200_OK) |
| 78 | + self.assertEqual(data["count"], 5) |
0 commit comments