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
9 changes: 2 additions & 7 deletions server/tests/test_costar_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,17 @@ def test_happy_path_returns_distilled_profile(self):


# ── GET /costar/analyze ───────────────────────────────────────────────────────
# NOTE: costar_analyze calls get_settings() but never uses the result — dead code
# that requires env vars in any environment. Patch it so tests don't need real secrets.

class TestCoStarAnalyzeEndpoint:
def test_404_when_no_row(self):
conn = FakeConn()
with patch("app.costar.router.get_conn", make_get_conn(conn)), \
patch("app.costar.router.get_settings", return_value=MagicMock()):
with patch("app.costar.router.get_conn", make_get_conn(conn)):
r = TestClient(_make_app(), raise_server_exceptions=False).get("/api/costar/analyze")
assert r.status_code == 404

def test_404_when_data_null(self):
conn = FakeConn(fetchrow_results=[{"costar_data": None}])
with patch("app.costar.router.get_conn", make_get_conn(conn)), \
patch("app.costar.router.get_settings", return_value=MagicMock()):
with patch("app.costar.router.get_conn", make_get_conn(conn)):
r = TestClient(_make_app(), raise_server_exceptions=False).get("/api/costar/analyze")
assert r.status_code == 404

Expand All @@ -257,7 +253,6 @@ def test_200_with_mocked_narrative(self):
}
conn = FakeConn(fetchrow_results=[{"costar_data": json.dumps(profile)}])
with patch("app.costar.router.get_conn", make_get_conn(conn)), \
patch("app.costar.router.get_settings", return_value=MagicMock()), \
patch(
"app.costar.router.chat_completion",
new=AsyncMock(return_value="Your water-dominant chart reveals deep intuition."),
Expand Down
Loading