Update python-glanceclient to allow anything < v2
The python-glanceclient pythonic API shouldn't break until v2 is released, so let's allow anything up to that known point. Alters the way test exceptions are constructed so that we're not dependent on the internals of how 3rd party libraries handle their exceptions while still being able to use them for real testing in Horizon. Fixes bug 1035511 Change-Id: I9a4379a19d5d6dee9d2349a73d9321def45ad78d
This commit is contained in:
parent
3640c380d1
commit
caf166eacb
@ -19,22 +19,37 @@ from novaclient import exceptions as nova_exceptions
|
|||||||
from .utils import TestDataContainer
|
from .utils import TestDataContainer
|
||||||
|
|
||||||
|
|
||||||
def data(TEST):
|
def create_stubbed_exception(cls, status_code=500):
|
||||||
TEST.exceptions = TestDataContainer()
|
|
||||||
msg = "Expected failure."
|
msg = "Expected failure."
|
||||||
|
|
||||||
keystone_unauthorized = keystone_exceptions.Unauthorized(401)
|
def fake_init_exception(self, code, message):
|
||||||
keystone_unauthorized.silence_logging = True
|
self.code = code
|
||||||
TEST.exceptions.keystone_unauthorized = keystone_unauthorized
|
self.message = message
|
||||||
|
|
||||||
keystone_exception = keystone_exceptions.ClientException(500, message=msg)
|
def fake_str(self):
|
||||||
keystone_exception.silence_logging = True
|
return str(self.message)
|
||||||
TEST.exceptions.keystone = keystone_exception
|
|
||||||
|
|
||||||
nova_exception = nova_exceptions.ClientException(500, message=msg)
|
def fake_unicode(self):
|
||||||
nova_exception.silence_logging = True
|
return unicode(self.message)
|
||||||
TEST.exceptions.nova = nova_exception
|
|
||||||
|
|
||||||
glance_exception = glance_exceptions.ClientException(500, message=msg)
|
cls.__init__ = fake_init_exception
|
||||||
glance_exception.silence_logging = True
|
cls.__str__ = fake_str
|
||||||
TEST.exceptions.glance = glance_exception
|
cls.__unicode__ = fake_unicode
|
||||||
|
cls.silence_logging = True
|
||||||
|
return cls(status_code, msg)
|
||||||
|
|
||||||
|
|
||||||
|
def data(TEST):
|
||||||
|
TEST.exceptions = TestDataContainer()
|
||||||
|
|
||||||
|
unauth = keystone_exceptions.Unauthorized
|
||||||
|
TEST.exceptions.keystone_unauthorized = create_stubbed_exception(unauth)
|
||||||
|
|
||||||
|
keystone_exception = keystone_exceptions.ClientException
|
||||||
|
TEST.exceptions.keystone = create_stubbed_exception(keystone_exception)
|
||||||
|
|
||||||
|
nova_exception = nova_exceptions.ClientException
|
||||||
|
TEST.exceptions.nova = create_stubbed_exception(nova_exception)
|
||||||
|
|
||||||
|
glance_exception = glance_exceptions.ClientException
|
||||||
|
TEST.exceptions.glance = create_stubbed_exception(glance_exception)
|
||||||
|
@ -6,7 +6,7 @@ set -o errexit
|
|||||||
# Increment me any time the environment should be rebuilt.
|
# Increment me any time the environment should be rebuilt.
|
||||||
# This includes dependncy changes, directory renames, etc.
|
# This includes dependncy changes, directory renames, etc.
|
||||||
# Simple integer secuence: 1, 2, 3...
|
# Simple integer secuence: 1, 2, 3...
|
||||||
environment_version=25
|
environment_version=26
|
||||||
#--------------------------------------------------------#
|
#--------------------------------------------------------#
|
||||||
|
|
||||||
function usage {
|
function usage {
|
||||||
|
@ -3,7 +3,7 @@ Django>=1.4
|
|||||||
django_compressor
|
django_compressor
|
||||||
django_openstack_auth
|
django_openstack_auth
|
||||||
python-cloudfiles
|
python-cloudfiles
|
||||||
python-glanceclient>=0.3,<0.4
|
python-glanceclient<2
|
||||||
python-keystoneclient
|
python-keystoneclient
|
||||||
python-novaclient
|
python-novaclient
|
||||||
pytz
|
pytz
|
||||||
|
Loading…
Reference in New Issue
Block a user