decomposer: scaffold crucible-agent-build-fastapi-endpoint
Some checks failed
ci / validate (push) Has been cancelled

This commit is contained in:
2026-08-09 15:40:46 +00:00
parent 399a062b49
commit f2021a2da1

View File

@@ -1,25 +1 @@
from collections.abc import AsyncIterator
import httpx
import pytest
from httpx import ASGITransport, AsyncClient
from monitor_service.api import create_app
from monitor_service.checker import CheckOutcome
from monitor_service.config import Settings
from monitor_service.models import CurrentStatus, MonitorState, utc_now
class StubChecker:
async def check(self, monitor_id: object, url: str) -> CheckOutcome:
return CheckOutcome(url.split("?", 1)[0], CurrentStatus(
state=MonitorState.up, checked_at=utc_now(), latency_ms=1.25, http_status=204
))
@pytest.fixture
async def client() -> AsyncIterator[AsyncClient]:
app = create_app(Settings(), checker=StubChecker()) # type: ignore[arg-type]
async with app.router.lifespan_context(app):
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as api:
yield api
# Env var setup that must run before app.config is imported.