| 84 | |
| 85 | @pytest.mark.run_loop |
| 86 | def 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 | |
| 102 | def test_HTTPFound_empty_location(): |