MCPcopy
hub / github.com/aio-libs/aiohttp / go

Method go

tests/test_web_functional.py:820–841  ·  view source on GitHub ↗
(dirname, filename)

Source from the content-addressed store, hash-verified

818
819 @asyncio.coroutine
820 def go(dirname, filename):
821 app, _, url = yield from self.create_server(
822 'GET', '/static/' + filename
823 )
824 app.router.add_static('/static', dirname)
825
826 resp = yield from request('GET', url, loop=self.loop)
827 self.assertEqual(200, resp.status)
828 txt = yield from resp.text()
829 self.assertEqual('file content', txt.rstrip())
830 ct = resp.headers['CONTENT-TYPE']
831 self.assertEqual('application/octet-stream', ct)
832 self.assertEqual(resp.headers.get('CONTENT-ENCODING'), None)
833 resp.close()
834
835 resp = yield from request('GET', url + 'fake', loop=self.loop)
836 self.assertEqual(404, resp.status)
837 resp.close()
838
839 resp = yield from request('GET', url + '/../../', loop=self.loop)
840 self.assertEqual(404, resp.status)
841 resp.close()
842
843 here = os.path.dirname(__file__)
844 filename = 'data.unknown_mime_type'

Callers

nothing calls this directly

Calls 12

create_serverMethod · 0.95
requestMethod · 0.95
closeMethod · 0.95
requestFunction · 0.90
TCPConnectorClass · 0.90
ClientSessionClass · 0.90
add_staticMethod · 0.80
textMethod · 0.45
getMethod · 0.45
closeMethod · 0.45
readMethod · 0.45
readanyMethod · 0.45

Tested by

no test coverage detected