feat: add lifespan integration and dependency injection

This commit is contained in:
Johan Lundberg 2026-02-13 13:59:59 +01:00
parent 9f4914a922
commit a45604ff2f
No known key found for this signature in database
GPG key ID: A6C152738D03C7D1
4 changed files with 88 additions and 3 deletions

View file

@ -9,12 +9,12 @@ from fastapi_oidc_op.config import Settings
@pytest.fixture
def settings() -> Settings:
return Settings(issuer="http://localhost:8000")
return Settings(issuer="http://localhost:8000", sqlite_path=":memory:")
@pytest.fixture
async def client(settings: Settings) -> AsyncIterator[AsyncClient]:
app = create_app(settings)
transport = ASGITransport(app=app)
async with AsyncClient(transport=transport, base_url=settings.issuer) as ac:
async with app.router.lifespan_context(app), AsyncClient(transport=transport, base_url=settings.issuer) as ac:
yield ac