Skip to content

Commit

Permalink
✅ [#499] Test log event when author marks list ready to review
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Nov 26, 2024
1 parent c89c915 commit 8e2983e
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 7 deletions.
28 changes: 26 additions & 2 deletions backend/src/openarchiefbeheer/destruction/tests/test_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,16 @@ def test_cannot_mark_as_final_if_posted_user_is_not_archivist(self):
)

def test_mark_as_ready_to_review(self):
record_manager = UserFactory.create(post__can_start_destruction=True)

record_manager = UserFactory.create(
username="dolly123",
first_name="Dolly",
last_name="Sheep",
post__can_start_destruction=True,
)
record_manager_group, created = Group.objects.get_or_create(
name="Record Manager"
)
record_manager.groups.add(record_manager_group)
destruction_list = DestructionListFactory.create(
name="A test list",
author=record_manager,
Expand Down Expand Up @@ -726,6 +734,22 @@ def test_mark_as_ready_to_review(self):
self.assertEqual(sent_mail[0].subject, "Destruction list review request")
self.assertEqual(sent_mail[0].recipients(), [reviewer.user.email])

logs = TimelineLog.objects.for_object(destruction_list)

self.assertEqual(logs.count(), 1)
self.assertEqual(
logs[0].get_message(),
_(
"User %(record_manager)s (member of group %(groups)s) has marked the "
'destruction list "%(list_name)s" as ready to review.'
)
% {
"record_manager": "Dolly Sheep (dolly123)",
"groups": "Record Manager",
"list_name": "A test list",
},
)

def test_cannot_mark_as_ready_to_review_if_not_authenticated(self):
destruction_list = DestructionListFactory.create(
name="A test list",
Expand Down
27 changes: 22 additions & 5 deletions backend/src/openarchiefbeheer/logging/tests/test_logevent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ def test_destruction_list_ready_for_first_review(self):
},
"resultaat": {
"url": "http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111",
"uuid": "111-111-111",
"toelichting": "Completed.",
"_expand": {
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
"omschrijving": "Completed.",
}
},
},
}
items[1].zaak._expand = {
Expand All @@ -43,8 +48,13 @@ def test_destruction_list_ready_for_first_review(self):
},
"resultaat": {
"url": "http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111",
"uuid": "111-111-111",
"toelichting": "Completed.",
"_expand": {
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
"omschrijving": "Completed.",
}
},
},
}
items[2].zaak._expand = {
Expand All @@ -56,8 +66,13 @@ def test_destruction_list_ready_for_first_review(self):
},
"resultaat": {
"url": "http://zaken-api.nl/zaken/api/v1/resultaten/222-222-222",
"uuid": "222-222-222",
"toelichting": "Abandoned.",
"_expand": {
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222",
"omschrijving": "Abandoned.",
}
},
},
}

Expand Down Expand Up @@ -99,11 +114,13 @@ def test_destruction_list_ready_for_first_review(self):
[
{
"label": "Abandoned.",
"value": "http://zaken-api.nl/zaken/api/v1/resultaten/222-222-222",
"value": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222",
"extra_data": {"toelichting": "Abandoned."},
},
{
"label": "Completed.",
"value": "http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111",
"value": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
"extra_data": {"toelichting": "Completed."},
},
],
)
Expand Down
1 change: 1 addition & 0 deletions backend/src/openarchiefbeheer/zaken/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def post(obj, create, extracted, **kwargs):
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
"archiefactietermijn": "P1D",
"omschrijving": "This is a result type",
}
},
},
Expand Down

0 comments on commit 8e2983e

Please sign in to comment.