Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def test_upload_pdf(self, client, pdf_upload, tmp_path, monkeypatch):
# Point the upload directory inside tmp_path (which is inside the project
# for the path-safety check — we monkeypatch the check).
monkeypatch.setattr(
"api.routes.templates.PROJECT_ROOT",
"app.api.routes.templates.PROJECT_ROOT",
tmp_path,
)
resp = client.post(
Expand Down Expand Up @@ -234,7 +234,7 @@ def fake_post(url, params=None, files=None, timeout=None):
captured["files"] = files
return fake_response

monkeypatch.setattr("api.routes.forms.requests.post", fake_post)
monkeypatch.setattr("app.api.routes.forms.requests.post", fake_post)

audio = ("audio", ("recording.wav", io.BytesIO(b"RIFFfake"), "audio/wav"))
resp = client.post("/forms/transcribe", files=[audio])
Expand All @@ -252,7 +252,7 @@ def test_list_models(self, client, monkeypatch):
fake_response = MagicMock()
fake_response.json.return_value = {"models": [{"name": "qwen2.5:3b"}, {"name": "mistral:latest"}]}
fake_response.raise_for_status.return_value = None
monkeypatch.setattr("api.routes.forms.requests.get", lambda *a, **k: fake_response)
monkeypatch.setattr("app.api.routes.forms.requests.get", lambda *a, **k: fake_response)
monkeypatch.setenv("OLLAMA_MODEL", "qwen2.5:1.5b")

resp = client.get("/forms/models")
Expand All @@ -269,7 +269,7 @@ def test_list_models_ollama_down(self, client, monkeypatch):
def boom(*a, **k):
raise requests.exceptions.ConnectionError("down")

monkeypatch.setattr("api.routes.forms.requests.get", boom)
monkeypatch.setattr("app.api.routes.forms.requests.get", boom)
monkeypatch.setenv("OLLAMA_MODEL", "qwen2.5:1.5b")

resp = client.get("/forms/models")
Expand All @@ -296,7 +296,7 @@ def test_transcribe_service_unavailable(self, client, monkeypatch):
def fake_post(*args, **kwargs):
raise requests.exceptions.ConnectionError("no service")

monkeypatch.setattr("api.routes.forms.requests.post", fake_post)
monkeypatch.setattr("app.api.routes.forms.requests.post", fake_post)

audio = ("audio", ("recording.wav", io.BytesIO(b"data"), "audio/wav"))
resp = client.post("/forms/transcribe", files=[audio])
Expand All @@ -315,7 +315,7 @@ class TestE2EPipeline:

def test_full_flow(self, client, mock_controller, pdf_upload, tmp_path, monkeypatch, db):
# -- Step 1: Upload a PDF --
monkeypatch.setattr("api.routes.templates.PROJECT_ROOT", tmp_path)
monkeypatch.setattr("app.api.routes.templates.PROJECT_ROOT", tmp_path)
upload_resp = client.post(
"/templates/upload",
files=[pdf_upload],
Expand Down