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)
评论列表
文章目录