decomposer: scaffold crucible-agent-build-fastapi-endpoint
Some checks failed
ci / validate (push) Has been cancelled
Some checks failed
ci / validate (push) Has been cancelled
This commit is contained in:
@@ -1,25 +1 @@
|
|||||||
from collections.abc import AsyncIterator
|
# Env var setup that must run before app.config is imported.
|
||||||
|
|
||||||
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user