feat: add lifespan integration and dependency injection
This commit is contained in:
parent
9f4914a922
commit
a45604ff2f
4 changed files with 88 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue