async def work(): async with AioHttpClient() as client: expected = await client.get_response(response) self.assertTrue(isinstance(expected, Response)) self.assertTrue(isinstance(expected.url, str)) self.assertEqual(_TARGET_URL, expected.url) self.assertTrue(isinstance(expected.text, str)) self.assertEqual('HTML', expected.text) self.assertTrue(isinstance(expected.status, int)) self.assertEqual(expected.status, 200) self.assertTrue(isinstance(expected.charset, str)) self.assertEqual(expected.charset, 'utf-8') self.assertTrue(isinstance(expected.content_type, str)) self.assertEqual(expected.content_type, 'text/html') self.assertTrue(isinstance(expected.content_length, int)) self.assertEqual(expected.content_length, 233) self.assertTrue(isinstance(expected.reason, str)) self.assertEqual(expected.reason, 'OK') self.assertTrue(isinstance(expected.headers, dict)) self.assertTrue('connection' in expected.headers) self.assertEqual(expected.headers['connection'], 'keep-alive') self.assertTrue(isinstance(expected.selector, _Element))
async def work(): async with AioHttpClient() as client: async with client.options(url=_TARGET_URL) as resp: self.assertEqual(status, resp.status)
async def work(): async with AioHttpClient() as client: async with client.request(method=method, url=_TARGET_URL) as resp: self.assertEqual(status, resp.status)
def _init_http_client(self): return AioHttpClient()