async def test_headers_prop(self): rm = core.RequestMatch("url", headers={"Content-Encoding": "header prop"}) mock_response = await rm.build_response(core.URL("url")) response = aiohttp_requests._Response(mock_response) assert response.headers["Content-Encoding"] == "header prop"
async def test_content_compressed(self, urllib3_mock): rm = core.RequestMatch("url", headers={"Content-Encoding": "gzip"}, payload="compressed") response = await rm.build_response(core.URL("url")) combined_response = aiohttp_requests._CombinedResponse( response=response) content = await combined_response.content() urllib3_mock.assert_called_once() assert content == "decompressed"
async def test_status_prop(self): rm = core.RequestMatch("url", status=123) mock_response = await rm.build_response(core.URL("url")) response = aiohttp_requests._Response(mock_response) assert response.status == 123