|
| 1 | +from unittest.mock import patch |
| 2 | + |
1 | 3 | from django.utils.translation import gettext_lazy as _
|
2 | 4 |
|
3 | 5 | import freezegun
|
@@ -61,46 +63,52 @@ def test_create_review_response(self):
|
61 | 63 | items_reviews = DestructionListItemReviewFactory.create_batch(
|
62 | 64 | 3,
|
63 | 65 | destruction_list_item__destruction_list=review.destruction_list,
|
| 66 | + destruction_list_item__with_zaak=True, |
| 67 | + destruction_list_item__zaak__selectielijstklasse="http://some-url.nl", |
64 | 68 | review=review,
|
65 | 69 | )
|
66 | 70 |
|
67 | 71 | endpoint = reverse("api:review-responses-list")
|
68 | 72 | self.client.force_authenticate(user=record_manager)
|
69 | 73 |
|
70 |
| - response = self.client.post( |
71 |
| - endpoint, |
72 |
| - data={ |
73 |
| - "review": review.pk, |
74 |
| - "comment": "A comment about the review.", |
75 |
| - "itemsResponses": [ |
76 |
| - { |
77 |
| - "reviewItem": items_reviews[0].pk, |
78 |
| - "actionItem": DestructionListItemAction.keep, |
79 |
| - "comment": "This zaak needs to stay in the list.", |
80 |
| - }, |
81 |
| - { |
82 |
| - "reviewItem": items_reviews[1].pk, |
83 |
| - "actionItem": DestructionListItemAction.remove, |
84 |
| - "actionZaak": { |
85 |
| - "action_type": ZaakActionType.selectielijstklasse_and_bewaartermijn, |
86 |
| - "selectielijstklasse": "http://some-url.nl", |
87 |
| - "archiefactiedatum": "2030-01-01", |
| 74 | + with patch( |
| 75 | + "openarchiefbeheer.destruction.api.serializers.retrieve_selectielijstklasse_resultaat", |
| 76 | + return_value={"waardering": "vernietigen"}, |
| 77 | + ): |
| 78 | + response = self.client.post( |
| 79 | + endpoint, |
| 80 | + data={ |
| 81 | + "review": review.pk, |
| 82 | + "comment": "A comment about the review.", |
| 83 | + "itemsResponses": [ |
| 84 | + { |
| 85 | + "reviewItem": items_reviews[0].pk, |
| 86 | + "actionItem": DestructionListItemAction.keep, |
| 87 | + "comment": "This zaak needs to stay in the list.", |
88 | 88 | },
|
89 |
| - "comment": "Changed the selectielijstklasse and removed from the list.", |
90 |
| - }, |
91 |
| - { |
92 |
| - "reviewItem": items_reviews[2].pk, |
93 |
| - "actionItem": DestructionListItemAction.remove, |
94 |
| - "actionZaak": { |
95 |
| - "action_type": ZaakActionType.bewaartermijn, |
96 |
| - "archiefactiedatum": "2030-01-01", |
| 89 | + { |
| 90 | + "reviewItem": items_reviews[1].pk, |
| 91 | + "actionItem": DestructionListItemAction.remove, |
| 92 | + "actionZaakType": ZaakActionType.selectielijstklasse_and_bewaartermijn, |
| 93 | + "actionZaak": { |
| 94 | + "selectielijstklasse": "http://some-url.nl", |
| 95 | + "archiefactiedatum": "2030-01-01", |
| 96 | + }, |
| 97 | + "comment": "Changed the selectielijstklasse and removed from the list.", |
97 | 98 | },
|
98 |
| - "comment": "Changed the archiefactiedatum and removed from the list.", |
99 |
| - }, |
100 |
| - ], |
101 |
| - }, |
102 |
| - format="json", |
103 |
| - ) |
| 99 | + { |
| 100 | + "reviewItem": items_reviews[2].pk, |
| 101 | + "actionItem": DestructionListItemAction.remove, |
| 102 | + "actionZaakType": ZaakActionType.bewaartermijn, |
| 103 | + "actionZaak": { |
| 104 | + "archiefactiedatum": "2030-01-01", |
| 105 | + }, |
| 106 | + "comment": "Changed the archiefactiedatum and removed from the list.", |
| 107 | + }, |
| 108 | + ], |
| 109 | + }, |
| 110 | + format="json", |
| 111 | + ) |
104 | 112 |
|
105 | 113 | self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
106 | 114 | self.assertEqual(ReviewResponse.objects.filter(review=review).count(), 1)
|
|
0 commit comments