I am using Quart App.
I am calling a service in my before_serving(app_initionalization) function and I do not want to call that in pytests. Actually, I want to disable my before_serving function or something like mock it.
import pytest
@pytest.mark.asyncio
async def test_my_api_call(test_app: Pint, headers: dict):
test_client = test_app.test_client()
response = await test_client.get("/get_user", headers)
assert response.status_code == 200
This is my test_app.
@pytest.fixture(name="test_app", scope="function")
async def _test_app(s3_client, tmp_path, async_mongodb):
os.environ["BLOB_STORE"] = str(tmp_path)
db_config['db'] = async_mongodb
async with app.test_app() as test_app:
yield test_app