Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Smoke tests for OneDrive download config (no browser)."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
SRC = ROOT / "src"
|
|
sys.path.insert(0, str(SRC))
|
|
|
|
from config import CONFIG_FILE, read_app_config, read_facility_list # noqa: E402
|
|
from onedrive_planner import _sanitize_folder_name, _xpath_literal # noqa: E402
|
|
|
|
|
|
def test_helpers() -> None:
|
|
assert _sanitize_folder_name("Test/Facility") == "Test_Facility"
|
|
assert _xpath_literal("Plain Name") == "'Plain Name'"
|
|
assert _xpath_literal("O'Brien Care") == '"O\'Brien Care"'
|
|
assert "concat" in _xpath_literal('O\'Brien "East" Wing')
|
|
print("OK: helper functions")
|
|
|
|
|
|
def test_config_loads() -> None:
|
|
path = CONFIG_FILE if CONFIG_FILE.exists() else ROOT / "Input" / "input.xlsx.example"
|
|
assert path.exists(), f"Missing config: {path}"
|
|
facilities = read_facility_list(path)
|
|
assert len(facilities) >= 1
|
|
cfg = read_app_config(path)
|
|
assert cfg.planner_url
|
|
print(f"OK: {len(facilities)} facilities from {path.name}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_helpers()
|
|
test_config_loads()
|
|
print("All smoke tests passed.")
|