def test_httpretty_bypasses_a_unregistered_request(context):
"httpretty should bypass a unregistered request by disabling it"
httpretty.register_uri(
httpretty.GET, "http://localhost:{0}/go-for-bubbles/".format(context.http_port),
body="glub glub")
fd = urllib2.urlopen('http://localhost:{0}/go-for-bubbles/'.format(context.http_port))
got1 = fd.read()
fd.close()
expect(got1).to.equal(b'glub glub')
fd = urllib2.urlopen('http://localhost:{0}/come-again/'.format(context.http_port))
got2 = fd.read()
fd.close()
expect(got2).to.equal(b'<- HELLO WORLD ->')
core.POTENTIAL_HTTP_PORTS.remove(context.http_port)
评论列表
文章目录