Skip to content

Commit

Permalink
🧪 [#397] Test delete local zaak metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed Oct 17, 2024
1 parent 0a0e2b5 commit bde1cab
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
52 changes: 52 additions & 0 deletions backend/src/openarchiefbeheer/destruction/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,3 +633,55 @@ def test_resume_after_failure(self, m):
],
["http://localhost:8003/zaken/api/v1/zaakinformatieobjecten/111-111-111"],
)

def test_clean_local_metadata(self):
destruction_list = DestructionListFactory.create(
processing_status=InternalStatus.succeeded,
status=ListStatus.deleted,
)
item1 = DestructionListItemFactory.create(
processing_status=InternalStatus.succeeded,
destruction_list=destruction_list,
extra_zaak_data={
"url": "http://zaken.nl/api/v1/zaken/111-111-111",
"omschrijving": "Test description 1",
"identificatie": "ZAAK-01",
"startdatum": "2020-01-01",
"einddatum": "2022-01-01",
"resultaat": "http://zaken.nl/api/v1/resultaten/111-111-111",
"zaaktype": {
"url": "http://catalogi.nl/api/v1/zaaktypen/111-111-111",
"omschrijving": "Tralala zaaktype",
"selectielijst_procestype": {
"nummer": 1,
},
},
},
)
item2 = DestructionListItemFactory.create(
processing_status=InternalStatus.succeeded,
destruction_list=destruction_list,
extra_zaak_data={
"url": "http://zaken.nl/api/v1/zaken/222-222-222",
"omschrijving": "Test description 2",
"identificatie": "ZAAK-02",
"startdatum": "2020-01-01",
"einddatum": "2022-01-01",
"resultaat": "http://zaken.nl/api/v1/resultaten/111-111-111",
"zaaktype": {
"url": "http://catalogi.nl/api/v1/zaaktypen/111-111-111",
"omschrijving": "Tralala zaaktype",
"selectielijst_procestype": {
"nummer": 1,
},
},
},
)

destruction_list.clear_local_metadata()

item1.refresh_from_db()
item2.refresh_from_db()

self.assertEqual(item1.extra_zaak_data, {})
self.assertEqual(item2.extra_zaak_data, {})
3 changes: 3 additions & 0 deletions backend/src/openarchiefbeheer/destruction/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ def test_process_list(self):
m_eio.assert_called()
m_zio.assert_called()

self.assertEqual(item1.extra_zaak_data, {})
self.assertEqual(item2.extra_zaak_data, {})

@log_capture(level=logging.INFO)
def test_item_skipped_if_already_succeeded(self, logs):
item = DestructionListItemFactory.create(
Expand Down

0 comments on commit bde1cab

Please sign in to comment.