diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/additional-eins-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/additional-eins-workbook-74099.xlsx new file mode 100644 index 0000000000..92e71e19f4 Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/additional-eins-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/additional-ueis-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/additional-ueis-workbook-74099.xlsx new file mode 100644 index 0000000000..a776fddeac Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/additional-ueis-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/audit-findings-text-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/audit-findings-text-workbook-74099.xlsx new file mode 100644 index 0000000000..5f3e9459f1 Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/audit-findings-text-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/corrective-action-plan-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/corrective-action-plan-workbook-74099.xlsx new file mode 100644 index 0000000000..7f699b0306 Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/corrective-action-plan-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/federal-awards-audit-findings-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/federal-awards-audit-findings-workbook-74099.xlsx new file mode 100644 index 0000000000..9508c76efe Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/federal-awards-audit-findings-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/federal-awards-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/federal-awards-workbook-74099.xlsx new file mode 100644 index 0000000000..8871eb83f2 Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/federal-awards-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/notes-to-sefa-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/notes-to-sefa-workbook-74099.xlsx new file mode 100644 index 0000000000..7bbe4ee609 Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/notes-to-sefa-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/secondary-auditors-workbook-74099.xlsx b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/secondary-auditors-workbook-74099.xlsx new file mode 100644 index 0000000000..6d2bf9fae0 Binary files /dev/null and b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/secondary-auditors-workbook-74099.xlsx differ diff --git a/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/test-array-74099.json b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/test-array-74099.json new file mode 100644 index 0000000000..0637a088a0 --- /dev/null +++ b/backend/census_historical_migration/fixtures/workbooks/should_pass/74099-16/test-array-74099.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/backend/census_historical_migration/management/commands/historic_workbook_generator.py b/backend/census_historical_migration/management/commands/historic_workbook_generator.py index 53618b4077..b2a03fdbec 100644 --- a/backend/census_historical_migration/management/commands/historic_workbook_generator.py +++ b/backend/census_historical_migration/management/commands/historic_workbook_generator.py @@ -14,7 +14,6 @@ import os import sys -import json import argparse import pprint import logging @@ -63,17 +62,8 @@ def handle(self, *args, **options): # noqa: C901 sys.exit() audit_header = get_audit_header(options["dbkey"], year) - json_test_tables = [] for section, fun in sections_to_handlers.items(): - (wb, api_json, _, filename) = generate_workbook(fun, audit_header, section) + (wb, _, filename) = generate_workbook(fun, audit_header, section) if wb: wb_path = os.path.join(outdir, filename) wb.save(wb_path) - if api_json: - json_test_tables.append(api_json) - - json_path = os.path.join(outdir, f'test-array-{options["dbkey"]}.json') - logger.info(f"Writing JSON to {json_path}") - with open(json_path, "w") as test_file: - jstr = json.dumps(json_test_tables, indent=2, sort_keys=True) - test_file.write(jstr) diff --git a/backend/census_historical_migration/test_corrective_action_plan_xforms.py b/backend/census_historical_migration/test_corrective_action_plan_xforms.py new file mode 100644 index 0000000000..0409cfc1f2 --- /dev/null +++ b/backend/census_historical_migration/test_corrective_action_plan_xforms.py @@ -0,0 +1,61 @@ +from django.conf import settings +from django.test import SimpleTestCase + +from .workbooklib.corrective_action_plan import ( + xform_add_placeholder_for_missing_references, +) + + +class TestXformAddPlaceholderForMissingCapText(SimpleTestCase): + class Findings: + def __init__(self, refnum): + self.FINDINGREFNUMS = refnum + + class CapText: + def __init__(self, refnum, seqnum=None, text=None, chartstables=None): + self.FINDINGREFNUMS = refnum + self.SEQ_NUMBER = seqnum + self.TEXT = text + self.CHARTSTABLES = chartstables + + def test_placeholder_addition_for_missing_references(self): + # Setup specific test data + mock_findings = [ + self.Findings("ref1"), + self.Findings("ref2"), + ] + mock_findings_texts = [ + self.CapText("ref1", "1", "text1", "chart1"), + ] + + findings_texts = xform_add_placeholder_for_missing_references( + mock_findings, mock_findings_texts + ) + + self.assertEqual( + len(findings_texts), 2 + ) # Expecting two items in findings_texts + self.assertEqual(findings_texts[1].FINDINGREFNUMS, "ref2") + self.assertEqual(findings_texts[1].TEXT, settings.GSA_MIGRATION) + self.assertEqual(findings_texts[1].CHARTSTABLES, settings.GSA_MIGRATION) + + def test_no_placeholder_addition_when_all_references_present(self): + # Setup specific test data + mock_findings = [ + self.Findings("ref1"), + self.Findings("ref2"), + ] + mock_findings_texts = [ + self.CapText("ref1", "1", "text1", "chart1"), + self.CapText("ref2", "2", "text2", "chart2"), + ] + + findings_texts = xform_add_placeholder_for_missing_references( + mock_findings, mock_findings_texts + ) + + self.assertEqual( + len(findings_texts), 2 + ) # Expecting two items in findings_texts + self.assertEqual(findings_texts[0].FINDINGREFNUMS, "ref1") + self.assertEqual(findings_texts[1].FINDINGREFNUMS, "ref2")