test_bypass.py 文件源码

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

项目:deb-python-httpretty 作者: openstack 项目源码 文件源码
def test_disallow_net_connect_1(context):
    """
    When allow_net_connect = False, a request that otherwise
    would have worked results in UnmockedError.
    """
    httpretty.register_uri(httpretty.GET, "http://falcao.it/foo/",
                           body="BAR")

    def foo():
        fd = None
        try:
            fd = urllib2.urlopen('http://localhost:{0}/go-for-bubbles/'.format(context.http_port))
        finally:
            if fd:
                fd.close()

    foo.should.throw(httpretty.UnmockedError)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号