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

Function test_HTTPFound

tests/test_web_exceptions.py:86–99  ·  view source on GitHub ↗
(buf, request)

Source from the content-addressed store, hash-verified

84
85@pytest.mark.run_loop
86def test_HTTPFound(buf, request):
87 resp = web.HTTPFound(location='/redirect')
88 assert '/redirect' == resp.location
89 assert '/redirect' == resp.headers['location']
90 yield from resp.prepare(request)
91 yield from resp.write_eof()
92 txt = buf.decode('utf8')
93 assert re.match('HTTP/1.1 302 Found\r\n'
94 'CONTENT-TYPE: text/plain; charset=utf-8\r\n'
95 'CONTENT-LENGTH: 10\r\n'
96 'LOCATION: /redirect\r\n'
97 'DATE: .+\r\n'
98 'SERVER: .+\r\n\r\n'
99 '302: Found', txt)
100
101
102def test_HTTPFound_empty_location():

Callers

nothing calls this directly

Calls 4

decodeMethod · 0.80
prepareMethod · 0.45
write_eofMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected