mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Renamer discovers _Sero Batch roots under Property Folders 🟥
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
7abf466b56
commit
dcd2a7442f
2 changed files with 34 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ BASE_PATH = (
|
|||
"Sero Project Documents/Property Folders"
|
||||
)
|
||||
ASSESSMENT_SUBFOLDER = "A. Assessment"
|
||||
BATCH_FOLDER_PREFIX = "_Sero Batch"
|
||||
|
||||
logger = setup_logger()
|
||||
|
||||
|
|
@ -65,6 +66,9 @@ class SharepointRenamerOrchestrator:
|
|||
self._csv_path = csv_path
|
||||
self._dry_run = dry_run
|
||||
|
||||
def _discover_roots(self) -> list[str]:
|
||||
raise NotImplementedError
|
||||
|
||||
def run(self) -> None:
|
||||
with open(self._csv_path, newline="", encoding="utf-8-sig") as f:
|
||||
reader = csv.DictReader(f)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ from unittest.mock import MagicMock
|
|||
import pytest
|
||||
|
||||
from orchestration.sharepoint_renamer_orchestrator import (
|
||||
BASE_PATH,
|
||||
SharepointRenamerOrchestrator,
|
||||
build_canonical_filename,
|
||||
)
|
||||
|
|
@ -47,6 +48,35 @@ def test_no_prefix_still_canonical() -> None:
|
|||
assert result == "100_1 High St AB1 2CD_Survey.pdf"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _discover_roots — batch subfolders become extra roots
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def test_discover_roots_includes_sero_batch_folders() -> None:
|
||||
# Arrange
|
||||
sp = MagicMock()
|
||||
sp.get_folders_in_path.return_value = {
|
||||
"value": [
|
||||
_make_folder("1 High St, AB1 2CD"),
|
||||
_make_folder("_Sero Batch 3"),
|
||||
_make_folder("_Sero Batch 2"),
|
||||
_make_file("stray.pdf"),
|
||||
]
|
||||
}
|
||||
|
||||
# Act
|
||||
roots = _make_orchestrator(sp)._discover_roots()
|
||||
|
||||
# Assert
|
||||
assert roots == [
|
||||
BASE_PATH,
|
||||
f"{BASE_PATH}/_Sero Batch 2",
|
||||
f"{BASE_PATH}/_Sero Batch 3",
|
||||
]
|
||||
sp.get_folders_in_path.assert_called_once_with(BASE_PATH)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _process_folder — files only at root level
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue