import string
import uuid
+import fixtures
+
from cinder.openstack.common import log as logging
from cinder import service
from cinder import test # For the flags
self.flags(**f)
self.flags(verbose=True)
+ for var in ('http_proxy', 'HTTP_PROXY'):
+ self.useFixture(fixtures.EnvironmentVariable(var))
+
# set up services
self.volume = self.start_service('volume')
self.scheduler = self.start_service('scheduler')
'var'))
+def open_no_proxy(*args, **kwargs):
+ opener = urllib2.build_opener(urllib2.ProxyHandler({}))
+ return opener.open(*args, **kwargs)
+
+
class TestLoaderNothingExists(test.TestCase):
"""Loader tests where os.path.exists always returns False."""
host="127.0.0.1", port=0)
server.start()
- 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()
server.start()
- 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()
port=0)
server.start()
- response = urllib2.urlopen('https://[::1]:%d/' % server.port)
+ response = open_no_proxy('https://[::1]:%d/' % server.port)
self.assertEqual(greetings, response.read())
server.stop()