test: add unit test suite for config, health checks, and lifespan wiring
This commit is contained in:
0
tests/unit/bootstrap/__init__.py
Normal file
0
tests/unit/bootstrap/__init__.py
Normal file
19
tests/unit/bootstrap/test_lifespan.py
Normal file
19
tests/unit/bootstrap/test_lifespan.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import pytest
|
||||
from fastapi import FastAPI
|
||||
from httpx import AsyncClient
|
||||
|
||||
from src.config import Settings
|
||||
|
||||
pytestmark = [pytest.mark.unit, pytest.mark.asyncio]
|
||||
|
||||
|
||||
async def test_lifespan_starts_and_stops_without_docker(client: AsyncClient) -> None:
|
||||
response = await client.get("/healthz")
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
async def test_lifespan_binds_resources_to_app_state(app: FastAPI, client: AsyncClient) -> None:
|
||||
await client.get("/healthz")
|
||||
resources = app.state.resources
|
||||
assert isinstance(resources.settings, Settings)
|
||||
assert resources.minio_client is not None
|
||||
Reference in New Issue
Block a user