Skip to content

Commit

Permalink
✅ [#557] Test deleting local destruction report
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Dec 24, 2024
1 parent 9aa2f52 commit 5c583f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 13 additions & 0 deletions backend/src/openarchiefbeheer/destruction/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
from datetime import date, datetime
from unittest.mock import patch

from django.contrib.auth.models import Group
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.base import ContentFile
from django.test import TestCase
from django.utils import timezone
from django.utils.translation import gettext
Expand Down Expand Up @@ -965,7 +967,15 @@ def test_clean_local_metadata(self):
destruction_list = DestructionListFactory.create(
processing_status=InternalStatus.succeeded,
status=ListStatus.deleted,
destruction_report=ContentFile(
b"Hello I am a report.", name="report_test.txt"
),
)

path = destruction_list.destruction_report.path
self.assertIsNotNone(destruction_list.destruction_report)
self.assertTrue(os.path.isfile(path))

item1 = DestructionListItemFactory.create(
processing_status=InternalStatus.succeeded,
destruction_list=destruction_list,
Expand Down Expand Up @@ -1012,6 +1022,9 @@ def test_clean_local_metadata(self):

self.assertEqual(item1.extra_zaak_data, {})
self.assertEqual(item2.extra_zaak_data, {})
with self.assertRaises(ValueError):
destruction_list.destruction_report.file
self.assertFalse(os.path.isfile(path))


class DestructionListCoReviewTest(TestCase):
Expand Down
4 changes: 0 additions & 4 deletions backend/src/openarchiefbeheer/destruction/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,6 @@ def test_complete_and_notify(self):

self.assertEqual(destruction_list.status, ListStatus.deleted)
self.assertEqual(destruction_list.processing_status, InternalStatus.succeeded)
self.assertEqual(
destruction_list.destruction_report.name,
"destruction_reports/2024/10/09/report_some-destruction-list.xlsx",
)
self.assertEqual(
destruction_list.end.astimezone(
tz=timezone.get_default_timezone()
Expand Down

0 comments on commit 5c583f2

Please sign in to comment.