Skip to content

Commit 8e2983e

Browse files
committed
✅ [#499] Test log event when author marks list ready to review
1 parent c89c915 commit 8e2983e

File tree

3 files changed

+49
-7
lines changed

3 files changed

+49
-7
lines changed

backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py

+26-2
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,16 @@ def test_cannot_mark_as_final_if_posted_user_is_not_archivist(self):
681681
)
682682

683683
def test_mark_as_ready_to_review(self):
684-
record_manager = UserFactory.create(post__can_start_destruction=True)
685-
684+
record_manager = UserFactory.create(
685+
username="dolly123",
686+
first_name="Dolly",
687+
last_name="Sheep",
688+
post__can_start_destruction=True,
689+
)
690+
record_manager_group, created = Group.objects.get_or_create(
691+
name="Record Manager"
692+
)
693+
record_manager.groups.add(record_manager_group)
686694
destruction_list = DestructionListFactory.create(
687695
name="A test list",
688696
author=record_manager,
@@ -726,6 +734,22 @@ def test_mark_as_ready_to_review(self):
726734
self.assertEqual(sent_mail[0].subject, "Destruction list review request")
727735
self.assertEqual(sent_mail[0].recipients(), [reviewer.user.email])
728736

737+
logs = TimelineLog.objects.for_object(destruction_list)
738+
739+
self.assertEqual(logs.count(), 1)
740+
self.assertEqual(
741+
logs[0].get_message(),
742+
_(
743+
"User %(record_manager)s (member of group %(groups)s) has marked the "
744+
'destruction list "%(list_name)s" as ready to review.'
745+
)
746+
% {
747+
"record_manager": "Dolly Sheep (dolly123)",
748+
"groups": "Record Manager",
749+
"list_name": "A test list",
750+
},
751+
)
752+
729753
def test_cannot_mark_as_ready_to_review_if_not_authenticated(self):
730754
destruction_list = DestructionListFactory.create(
731755
name="A test list",

backend/src/openarchiefbeheer/logging/tests/test_logevent.py

+22-5
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@ def test_destruction_list_ready_for_first_review(self):
3030
},
3131
"resultaat": {
3232
"url": "http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111",
33-
"uuid": "111-111-111",
3433
"toelichting": "Completed.",
34+
"_expand": {
35+
"resultaattype": {
36+
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
37+
"omschrijving": "Completed.",
38+
}
39+
},
3540
},
3641
}
3742
items[1].zaak._expand = {
@@ -43,8 +48,13 @@ def test_destruction_list_ready_for_first_review(self):
4348
},
4449
"resultaat": {
4550
"url": "http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111",
46-
"uuid": "111-111-111",
4751
"toelichting": "Completed.",
52+
"_expand": {
53+
"resultaattype": {
54+
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
55+
"omschrijving": "Completed.",
56+
}
57+
},
4858
},
4959
}
5060
items[2].zaak._expand = {
@@ -56,8 +66,13 @@ def test_destruction_list_ready_for_first_review(self):
5666
},
5767
"resultaat": {
5868
"url": "http://zaken-api.nl/zaken/api/v1/resultaten/222-222-222",
59-
"uuid": "222-222-222",
6069
"toelichting": "Abandoned.",
70+
"_expand": {
71+
"resultaattype": {
72+
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222",
73+
"omschrijving": "Abandoned.",
74+
}
75+
},
6176
},
6277
}
6378

@@ -99,11 +114,13 @@ def test_destruction_list_ready_for_first_review(self):
99114
[
100115
{
101116
"label": "Abandoned.",
102-
"value": "http://zaken-api.nl/zaken/api/v1/resultaten/222-222-222",
117+
"value": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222",
118+
"extra_data": {"toelichting": "Abandoned."},
103119
},
104120
{
105121
"label": "Completed.",
106-
"value": "http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111",
122+
"value": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
123+
"extra_data": {"toelichting": "Completed."},
107124
},
108125
],
109126
)

backend/src/openarchiefbeheer/zaken/tests/factories.py

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ def post(obj, create, extracted, **kwargs):
5555
"resultaattype": {
5656
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
5757
"archiefactietermijn": "P1D",
58+
"omschrijving": "This is a result type",
5859
}
5960
},
6061
},

0 commit comments

Comments
 (0)