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 92e0438
Showing 1 changed file with 13 additions and 0 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

0 comments on commit 92e0438

Please sign in to comment.