|
7 | 7 | from django.utils.translation import gettext as _, ngettext
|
8 | 8 |
|
9 | 9 | from freezegun import freeze_time
|
| 10 | +from openpyxl import load_workbook |
10 | 11 | from privates.test import temp_private_root
|
11 | 12 | from requests import HTTPError
|
12 | 13 | from requests_mock import Mocker
|
@@ -439,16 +440,38 @@ def test_process_list(self):
|
439 | 440 | ).exists()
|
440 | 441 | )
|
441 | 442 |
|
442 |
| - lines = [line for line in destruction_list.destruction_report.readlines()] |
| 443 | + wb = load_workbook(filename=destruction_list.destruction_report.path) |
| 444 | + sheet_deleted_zaken = wb[_("Deleted zaken")] |
| 445 | + rows = list(sheet_deleted_zaken.iter_rows(values_only=True)) |
443 | 446 |
|
444 |
| - self.assertEqual(len(lines), 3) |
| 447 | + self.assertEqual(len(rows), 3) |
445 | 448 | self.assertEqual(
|
446 |
| - lines[1], |
447 |
| - b"http://zaken.nl/api/v1/zaken/111-111-111,2022-01-01,http://zaken.nl/api/v1/resultaten/111-111-111,2020-01-01,Test description 1,ZAAK-01,http://catalogue-api.nl/zaaktypen/111-111-111,Aangifte behandelen,1\n", |
| 449 | + rows[1], |
| 450 | + ( |
| 451 | + "http://zaken.nl/api/v1/zaken/111-111-111", |
| 452 | + "2022-01-01", |
| 453 | + "http://zaken.nl/api/v1/resultaten/111-111-111", |
| 454 | + "2020-01-01", |
| 455 | + "Test description 1", |
| 456 | + "ZAAK-01", |
| 457 | + "http://catalogue-api.nl/zaaktypen/111-111-111", |
| 458 | + "Aangifte behandelen", |
| 459 | + 1, |
| 460 | + ), |
448 | 461 | )
|
449 | 462 | self.assertEqual(
|
450 |
| - lines[2], |
451 |
| - b"http://zaken.nl/api/v1/zaken/222-222-222,2022-01-02,http://zaken.nl/api/v1/resultaten/111-111-222,2020-01-02,Test description 2,ZAAK-02,http://catalogue-api.nl/zaaktypen/111-111-111,Aangifte behandelen,1\n", |
| 463 | + rows[2], |
| 464 | + ( |
| 465 | + "http://zaken.nl/api/v1/zaken/222-222-222", |
| 466 | + "2022-01-02", |
| 467 | + "http://zaken.nl/api/v1/resultaten/111-111-222", |
| 468 | + "2020-01-02", |
| 469 | + "Test description 2", |
| 470 | + "ZAAK-02", |
| 471 | + "http://catalogue-api.nl/zaaktypen/111-111-111", |
| 472 | + "Aangifte behandelen", |
| 473 | + 1, |
| 474 | + ), |
452 | 475 | )
|
453 | 476 |
|
454 | 477 | m_zaak.assert_called()
|
@@ -583,19 +606,41 @@ def test_complete_and_notify(self):
|
583 | 606 | self.assertEqual(destruction_list.processing_status, InternalStatus.succeeded)
|
584 | 607 | self.assertEqual(
|
585 | 608 | destruction_list.destruction_report.name,
|
586 |
| - "destruction_reports/2024/10/09/report_some-destruction-list.csv", |
| 609 | + "destruction_reports/2024/10/09/report_some-destruction-list.xlsx", |
587 | 610 | )
|
588 | 611 |
|
589 |
| - lines = [line for line in destruction_list.destruction_report.readlines()] |
| 612 | + wb = load_workbook(filename=destruction_list.destruction_report.path) |
| 613 | + sheet_deleted_zaken = wb[_("Deleted zaken")] |
| 614 | + rows = list(sheet_deleted_zaken.iter_rows(values_only=True)) |
590 | 615 |
|
591 |
| - self.assertEqual(len(lines), 2) |
| 616 | + self.assertEqual(len(rows), 2) |
592 | 617 | self.assertEqual(
|
593 |
| - lines[0], |
594 |
| - b"url,einddatum,resultaat,startdatum,omschrijving,identificatie,zaaktype url,zaaktype omschrijving,selectielijst procestype nummer\n", |
| 618 | + rows[0], |
| 619 | + ( |
| 620 | + "url", |
| 621 | + "einddatum", |
| 622 | + "resultaat", |
| 623 | + "startdatum", |
| 624 | + "omschrijving", |
| 625 | + "identificatie", |
| 626 | + "zaaktype url", |
| 627 | + "zaaktype omschrijving", |
| 628 | + "selectielijst procestype nummer", |
| 629 | + ), |
595 | 630 | )
|
596 | 631 | self.assertEqual(
|
597 |
| - lines[1], |
598 |
| - b"http://zaken.nl/api/v1/zaken/111-111-111,2022-01-01,http://zaken.nl/api/v1/resultaten/111-111-111,2020-01-01,Test description 1,ZAAK-01,http://catalogi.nl/api/v1/zaaktypen/111-111-111,Tralala zaaktype,1\n", |
| 632 | + rows[1], |
| 633 | + ( |
| 634 | + "http://zaken.nl/api/v1/zaken/111-111-111", |
| 635 | + "2022-01-01", |
| 636 | + "http://zaken.nl/api/v1/resultaten/111-111-111", |
| 637 | + "2020-01-01", |
| 638 | + "Test description 1", |
| 639 | + "ZAAK-01", |
| 640 | + "http://catalogi.nl/api/v1/zaaktypen/111-111-111", |
| 641 | + "Tralala zaaktype", |
| 642 | + 1, |
| 643 | + ), |
599 | 644 | )
|
600 | 645 |
|
601 | 646 | @override_settings(CELERY_TASK_ALWAYS_EAGER=True)
|
|
0 commit comments