-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
28f1807
commit 65a6f76
Showing
2 changed files
with
115 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
backend/src/openarchiefbeheer/destruction/tests/serializers/test_destruction_list_item.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from django.test import TestCase | ||
|
||
from openarchiefbeheer.accounts.tests.factories import UserFactory | ||
|
||
from ...api.serializers import DestructionListItemReadSerializer | ||
from ...constants import DestructionListItemAction, ListStatus | ||
from ..factories import ( | ||
DestructionListItemReviewFactory, | ||
DestructionListReviewFactory, | ||
ReviewItemResponseFactory, | ||
) | ||
|
||
|
||
class TestDestructionListItemSerializer(TestCase): | ||
def test_ignored_review_advice(self): | ||
record_manager = UserFactory.create(post__can_start_destruction=True) | ||
review = DestructionListReviewFactory.create( | ||
destruction_list__author=record_manager, | ||
destruction_list__status=ListStatus.changes_requested, | ||
) | ||
item_reviews = DestructionListItemReviewFactory.create_batch( | ||
3, | ||
destruction_list_item__destruction_list=review.destruction_list, | ||
review=review, | ||
) | ||
ReviewItemResponseFactory.create( | ||
review_item=item_reviews[1], | ||
review_item__review=review, | ||
action_item=DestructionListItemAction.keep, | ||
) | ||
ReviewItemResponseFactory.create( | ||
review_item=item_reviews[2], | ||
review_item__review=review, | ||
action_item=DestructionListItemAction.remove, | ||
) | ||
|
||
with self.subTest("Accepted item"): | ||
serialiser = DestructionListItemReadSerializer( | ||
instance=item_reviews[0].destruction_list_item | ||
) | ||
|
||
self.assertIsNone(serialiser.data["review_advice_ignored"]) | ||
|
||
with self.subTest("Item with ignored feedback"): | ||
serialiser = DestructionListItemReadSerializer( | ||
instance=item_reviews[1].destruction_list_item | ||
) | ||
|
||
self.assertTrue(serialiser.data["review_advice_ignored"]) | ||
|
||
with self.subTest("Item with accepted feedback"): | ||
serialiser = DestructionListItemReadSerializer( | ||
instance=item_reviews[2].destruction_list_item | ||
) | ||
|
||
self.assertFalse(serialiser.data["review_advice_ignored"]) |