# request-mock - https://requests-mock.readthedocs.io/en/latest/mocker.html#activation import requests_mock @pytest.mark.asyncio async def test_mock_login( client, requests_mock: requests_mock.Mocker, ): .... requests_mock.get(host, text=json.dumps(return_data)) ....