import pytest from fastapi.testclient import TestClient from pigway_frame_flow.api.app import create_app from pigway_frame_flow.settings import Settings @pytest.fixture def settings(tmp_path): return Settings( data_dir=tmp_path / "data", config_dir=tmp_path / "config", api_token="test-frame-token", mock=True, ) @pytest.fixture def app(settings): return create_app(settings, start_worker=False) @pytest.fixture def client(app): with TestClient(app) as c: c.headers["Authorization"] = "Bearer test-frame-token" yield c @pytest.fixture def service(app): return app.state.service @pytest.fixture def legacy_photo_engine(monkeypatch): """Exercise retained legacy internals without weakening production policy. These fixtures cover rendering, retention and migration algorithms that used filesystem inputs historically. API boundary tests never use this override. """ from pigway_frame_flow.providers.photo_sources import PhotoSources monkeypatch.setattr( PhotoSources, "require_api_source", staticmethod(lambda source: None) )