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

from fastapi.testclient import TestClient


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

    def test_connect_unauthenticated_returns_401(self, client: TestClient):
        assert client.post("/api/garmin/connect", json={}).status_code == 401

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

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

    def test_connect_missing_fields_returns_400(self, user_client: TestClient):
        r = user_client.post("/api/garmin/connect", json={})
        assert r.status_code == 400
