DocDoeAI / tests /test_ask_tracking_failures.py
asnannp's picture
Deploy backend cd4237ff: support routes + rate limit + exam_date nullable + upload 413 fix
7c6ffa6
Raw
History Blame Contribute Delete
708 Bytes
from __future__ import annotations
def test_ask_survives_best_effort_tracking_failures(client, monkeypatch):
from app.routes import ask
def fail_tracking(*_args, **_kwargs):
raise RuntimeError("tracking failure")
monkeypatch.setattr(ask, "record_topic_attempt", fail_tracking)
monkeypatch.setattr(ask, "record_generation", fail_tracking)
monkeypatch.setattr(ask, "increment_usage", fail_tracking)
response = client.post(
"/ask",
json={
"question": "Teach photosynthesis in exam scoring points.",
"mode": "exam_answer",
},
)
assert response.status_code == 200
body = response.json()
assert "answer" in body