import pytest from httpx import AsyncClient, ASGITransport from app.main import create_app from app.indicators import registry from app.indicators.base import BaseIndicator from app.models import AOI, TimeRange, IndicatorResult, StatusLevel, TrendDirection, ConfidenceLevel class StubIndicator(BaseIndicator): id = "stub" name = "Stub" category = "test" question = "Is this a stub?" estimated_minutes = 1 async def process(self, aoi: AOI, time_range: TimeRange) -> IndicatorResult: raise NotImplementedError @pytest.fixture async def client(temp_db_path): registry._indicators.clear() registry.register(StubIndicator()) app = create_app(db_path=temp_db_path) transport = ASGITransport(app=app) async with AsyncClient(transport=transport, base_url="http://test") as c: yield c @pytest.mark.asyncio async def test_list_indicators(client): resp = await client.get("/api/indicators") assert resp.status_code == 200 data = resp.json() assert len(data) >= 1 assert data[0]["id"] == "stub" assert data[0]["question"] == "Is this a stub?"