test_inbound.py 文件源码

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

项目:yarpc-python 作者: yarpc 项目源码 文件源码
def test_bad_request_error(req, msg):
    inbound = HTTPInbound()
    inbound.start(None)

    client = AsyncHTTPClient()

    req.url = 'http://localhost:%s' % inbound.port
    req.method = 'POST'
    req.body = ''

    with pytest.raises(HTTPError) as e:
        yield client.fetch(req)

    e = e.value
    assert e.code >= 400 and e.code <= 500
    assert e.response.body == msg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号