test_interceptor.py 文件源码

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

项目:deb-python-wsgi-intercept 作者: openstack 项目源码 文件源码
def test_httplib2_in_out():
    hostname = str(uuid4())
    port = 9999
    url = 'http://%s:%s/' % (hostname, port)
    http = Http()
    with Httplib2Interceptor(app=app, url=url) as target_url:
        response, content = http.request(target_url)
        assert response.status == 200
        assert 'WSGI intercept successful!' in content.decode('utf-8')

    # outside the context manager the intercept does not work
    with py.test.raises(ServerNotFoundError):
        http.request(url)


# Requests
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号