from pathlib import Path from app.config import load_config def test_load_config_reads_thresholds(tmp_path: Path): cfg = tmp_path / "config.yaml" cfg.write_text( "camera_id: store_cam_01\n" "thresholds:\n" " queue_time_threshold_seconds: 300\n" " crowded_count_threshold: 5\n" " normal_count_threshold: 2\n", encoding="utf-8", ) data = load_config(cfg) assert data.camera_id == "store_cam_01" assert data.thresholds.queue_time_threshold_seconds == 300 assert data.thresholds.crowded_count_threshold == 5 assert data.thresholds.normal_count_threshold == 2 def test_load_config_uses_defaults_for_optional_sections(tmp_path: Path): cfg = tmp_path / "config.yaml" cfg.write_text("camera_id: store_cam_01\n", encoding="utf-8") data = load_config(cfg) assert data.stream.sample_fps == 2.0 assert data.staff.min_hits == 3 assert data.event_sink.path == "logs/events.jsonl" assert data.webhook.url == "" assert data.webhook.timeout_seconds == 5.0