Merge "Ignore http_proxy while connecting to test WSGI server"

This commit is contained in:
Jenkins 2014-08-26 08:37:34 +00:00 committed by Gerrit Code Review
commit eb85c5cc02

View File

@ -35,6 +35,11 @@ TEST_VAR_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
'..', 'var'))
def open_no_proxy(*args, **kwargs):
opener = urllib2.build_opener(urllib2.ProxyHandler({}))
return opener.open(*args, **kwargs)
class TestWSGIServer(base.BaseTestCase):
"""WSGI server tests."""
@ -120,7 +125,8 @@ class TestWSGIServer(base.BaseTestCase):
server = wsgi.Server("test_app")
server.start(hello_world, 0, host="127.0.0.1")
response = urllib2.urlopen('http://127.0.0.1:%d/' % server.port)
response = open_no_proxy('http://127.0.0.1:%d/' % server.port)
self.assertEqual(greetings, response.read())
server.stop()
@ -1088,7 +1094,8 @@ class TestWSGIServerWithSSL(base.BaseTestCase):
server = wsgi.Server("test_app")
server.start(hello_world, 0, host="127.0.0.1")
response = urllib2.urlopen('https://127.0.0.1:%d/' % server.port)
response = open_no_proxy('https://127.0.0.1:%d/' % server.port)
self.assertEqual(greetings, response.read())
server.stop()
@ -1107,7 +1114,8 @@ class TestWSGIServerWithSSL(base.BaseTestCase):
server = wsgi.Server("test_app")
server.start(hello_world, 0, host="127.0.0.1")
response = urllib2.urlopen('https://127.0.0.1:%d/' % server.port)
response = open_no_proxy('https://127.0.0.1:%d/' % server.port)
self.assertEqual(greetings, response.read())
server.stop()
@ -1128,7 +1136,8 @@ class TestWSGIServerWithSSL(base.BaseTestCase):
server = wsgi.Server("test_app")
server.start(hello_world, 0, host="::1")
response = urllib2.urlopen('https://[::1]:%d/' % server.port)
response = open_no_proxy('https://[::1]:%d/' % server.port)
self.assertEqual(greetings, response.read())
server.stop()