Skip to content

Commit add5575

Browse files
ShreeBoharaclaude
andcommitted
Test the chat mount behaviourally too
Third CI failure on the same test, which was the signal that the whole approach was wrong: it kept asserting against app.routes, whose contents differ by FastAPI/Strawberry version, and pytest truncates long set reprs with "..." so the failure output was actively misleading about what the set contained. Replaced the last route-table assertion with a request: POST /api/chat/sessions with an empty body must not 404. A 404 would mean the router is gone; validation rejecting the body proves the route exists, without needing a provider or a real session. Verified with apps/api/.env moved aside and all provider keys unset: 142 passed, ruff clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 909e7a7 commit add5575

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apps/api/tests/integration/test_graphql.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,12 @@ def test_graphql_is_mounted_alongside_rest(gql_env):
100100

101101
# And REST still answers, on the same app.
102102
assert client.get(f"/api/learning/{repo_id}/stats").status_code == 200
103-
paths = {getattr(r, "path", "") for r in app.routes}
104-
assert any(p.startswith("/api/chat") for p in paths), "chat must remain on REST/SSE"
103+
104+
# Chat is still routed. A 404 would mean the router is gone; an empty body should be
105+
# rejected by validation instead, which proves the route exists without needing a
106+
# provider or a real session.
107+
chat = client.post("/api/chat/sessions", json={})
108+
assert chat.status_code != 404, "chat must remain on REST/SSE"
105109

106110

107111
def test_repo_query(gql_env):

0 commit comments

Comments
 (0)