feat: expose recommendation streaming api

This commit is contained in:
Justin Visser 2026-08-10 13:41:43 +02:00
parent e8d20158e3
commit 41aa93c3c7
7 changed files with 473 additions and 12 deletions

View file

@ -90,5 +90,32 @@ def test_spotify_failure_during_callback_redirects_to_login_error() -> None:
assert response.headers["location"] == "/?login=error"
def test_seed_session_authenticates_requests_without_a_cookie() -> None:
async def spotify_handler(request: httpx2.Request) -> httpx2.Response:
if request.url.host == "accounts.spotify.com":
return httpx2.Response(200, json={"access_token": "seed-access", "expires_in": 3600})
assert request.url.path == "/v1/me"
return httpx2.Response(200, json={"id": "seed-account", "display_name": "Seed Listener"})
app = create_app(
application_settings=Settings(
app_mode=AppMode.LIVE,
spotify_client_id="client-id",
anthropic_api_key="test-key",
spotify_seed_refresh_token="seed-refresh",
),
http_transport=httpx2.MockTransport(spotify_handler),
)
with TestClient(app) as client:
response = client.get("/api/auth/me")
assert response.status_code == 200
assert response.json() == {"display_name": "Seed Listener"}
def _live_settings() -> Settings:
return Settings(app_mode=AppMode.LIVE, spotify_client_id="client-id")
return Settings(
app_mode=AppMode.LIVE,
spotify_client_id="client-id",
anthropic_api_key="test-key",
)