From 9e48f39fa5e0247525255f45f9b4a60f57836678 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 29 Jul 2026 08:45:20 +0000 Subject: [PATCH] =?UTF-8?q?List=20the=20UPRNs=20with=20no=20SharePoint=20f?= =?UTF-8?q?older=20under=20any=20root=20=F0=9F=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5 (1M context) --- tests/scripts/test_rename_sharepoint_files.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/scripts/test_rename_sharepoint_files.py b/tests/scripts/test_rename_sharepoint_files.py index e83782b2a..7b1ee0680 100644 --- a/tests/scripts/test_rename_sharepoint_files.py +++ b/tests/scripts/test_rename_sharepoint_files.py @@ -296,6 +296,33 @@ def test_run_warns_once_when_property_missing_from_all_roots( assert "400" in warnings[0].message +def test_run_summary_lists_uprns_with_no_folder_under_any_root( + tmp_path: Path, +) -> None: + # Arrange + csv_path = _write_csv( + tmp_path, [("400", "4 Elm St", "AA2 2BB"), ("500", "5 Pine Ln", "BB3 3CC")] + ) + found_assessment = _assessment_path(BASE_PATH, "5 Pine Ln", "BB3 3CC") + + sp = MagicMock() + + def fake_get(path: str) -> dict[str, Any]: + if path == BASE_PATH: + return {"value": []} + if path == found_assessment: + return {"value": []} + raise ValueError("not found") + + sp.get_folders_in_path.side_effect = fake_get + + # Act + summary = SharepointRenamerOrchestrator(sp, csv_path).run() + + # Assert + assert summary.missing_folders == ["400"] + + # --------------------------------------------------------------------------- # _process_folder — already-canonical files are skipped # ---------------------------------------------------------------------------