Beispiel #1
0
def mock_request_response(
    status: int, data: str, content_type: str = "application/json"
):
    """Return the default mocked config entry data."""

    mock_response = AsyncMock()
    mock_response.status = status
    mock_response.content_type = content_type

    async def return_json():
        return json.loads(data)

    mock_response.json = return_json

    return mock_response