decomposer: scaffold crucible-agent-build-fastapi-endpoint
This commit is contained in:
@@ -1,29 +1 @@
|
|||||||
from collections.abc import AsyncIterator
|
# Env var setup that must run before app.config is imported.
|
||||||
|
|
||||||
import pytest
|
|
||||||
from fastapi.testclient import TestClient
|
|
||||||
|
|
||||||
from app.config import Settings
|
|
||||||
from app.main import create_app
|
|
||||||
from app.models import CurrentStatus, MonitorState, utc_now
|
|
||||||
|
|
||||||
|
|
||||||
class FakeChecker:
|
|
||||||
async def check(self, monitor_id: str, target_url: str) -> CurrentStatus:
|
|
||||||
return CurrentStatus(
|
|
||||||
state=MonitorState.UP,
|
|
||||||
checked_at=utc_now(),
|
|
||||||
latency_ms=3.5,
|
|
||||||
http_status=204,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def anyio_backend() -> str:
|
|
||||||
return "asyncio"
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client() -> AsyncIterator[TestClient]:
|
|
||||||
with TestClient(create_app(Settings(), checker=FakeChecker())) as test_client: # type: ignore[arg-type]
|
|
||||||
yield test_client
|
|
||||||
|
|||||||
Reference in New Issue
Block a user