"""Pre-split regression tests for /api/strava/* routes."""
from __future__ import annotations

from fastapi.testclient import TestClient


class TestStravaRoutes:
    def test_status_unauthenticated_returns_401(self, client: TestClient):
        assert client.get("/api/strava/status").status_code == 401

    def test_disconnect_unauthenticated_returns_401(self, client: TestClient):
        assert client.post("/api/strava/disconnect").status_code == 401

    def test_auth_url_unauthenticated_returns_401(self, client: TestClient):
        assert client.get("/api/strava/auth-url").status_code == 401

    def test_sync_unauthenticated_returns_401(self, client: TestClient):
        assert client.post("/api/strava/sync").status_code == 401

    def test_status_authenticated_returns_connected_field(self, user_client: TestClient):
        r = user_client.get("/api/strava/status")
        assert r.status_code == 200
        assert "connected" in r.json()
