test_web_functional.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:aiohttp-tokio 作者: fafhrd91 项目源码 文件源码
def test_redirect_url(loop, test_client):

    @asyncio.coroutine
    def redirector(request):
        raise web.HTTPFound(location=URL('/redirected'))

    @asyncio.coroutine
    def redirected(request):
        return web.Response()

    app = web.Application()
    app.router.add_get('/redirector', redirector)
    app.router.add_get('/redirected', redirected)

    client = yield from test_client(app)
    resp = yield from client.get('/redirector')
    assert resp.status == 200
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号