Testing dependency call args in FastAPI
I have an api with a route that creates google cloud tasks. I import the task client as dependency into the endpoint. I mocked the task client in my tests with app.dependency_overrides
but now I’m not sure how to use that in order to see the call args for the send_task_to_queue
function. In my old flask api I could just patch send_task_to_queue
and check its call_args
but trying that here is giving me None
How to use LifespanManager to test a reverse proxy in FastAPI (async testing)
According to FastAPI documentation I may need to use a LifespanManager. Can someone show me an example of how to use the LifespanManager in an async test? Like, with this lifespan: