import os from app import create_app from app.config import Config def _app(tmp_path): cfg = Config(immich_url="http://x", immich_api_key="k", anthropic_api_key="", data_dir=str(tmp_path)) app = create_app(cfg) app.config.update(TESTING=True) return app def test_health(tmp_path): assert _app(tmp_path).test_client().get("/health").data == b"ok" def test_thumb_served(tmp_path): thumbs = os.path.join(str(tmp_path), "thumbs") os.makedirs(thumbs, exist_ok=True) with open(os.path.join(thumbs, "a.jpg"), "wb") as f: f.write(b"\xff\xd8\xffjpeg") client = _app(tmp_path).test_client() r = client.get("/thumb/a") assert r.status_code == 200 and r.mimetype == "image/jpeg" assert _app(tmp_path).test_client().get("/thumb/missing").status_code == 404