summaryrefslogtreecommitdiff
path: root/nova/tests/image
diff options
context:
space:
mode:
authorJay Pipes <jaypipes@gmail.com>2014-08-09 15:46:01 -0700
committerJay Pipes <jaypipes@gmail.com>2014-08-15 16:20:51 +0000
commit8a50755b9df445a07140f385f1ff32db20bf683b (patch)
tree91d9393bf07cd4e0ee5e922e9ffaff9d507336d7 /nova/tests/image
parent486623c0ca6d71ace5e6b0cd234be05f10f13dc4 (diff)
downloadnova-8a50755b9df445a07140f385f1ff32db20bf683b.tar.gz
Remove final use of glance_stubs
Removes the final piece of glance_stubs from the image unit tests. Change-Id: I0db3b6c83edaf91466e85d423ce75b3e75fd3517 Closes-bug: #1293938
Diffstat (limited to 'nova/tests/image')
-rw-r--r--nova/tests/image/test_glance.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py
index fbc795a84c..d72061e218 100644
--- a/nova/tests/image/test_glance.py
+++ b/nova/tests/image/test_glance.py
@@ -26,7 +26,6 @@ from nova import context
from nova import exception
from nova.image import glance
from nova import test
-from nova.tests.glance import stubs as glance_stubs
from nova import utils
CONF = cfg.CONF
@@ -57,7 +56,9 @@ class TestConversions(test.NoDBTestCase):
def _test_extracting_missing_attributes(self, include_locations):
# Verify behavior from glance objects that are missing attributes
- class MyFakeGlanceImage(glance_stubs.FakeImage):
+ # TODO(jaypipes): Find a better way of testing this crappy
+ # glanceclient magic object stuff.
+ class MyFakeGlanceImage(object):
def __init__(self, metadata):
IMAGE_ATTRIBUTES = ['size', 'owner', 'id', 'created_at',
'updated_at', 'status', 'min_disk',
@@ -66,6 +67,18 @@ class TestConversions(test.NoDBTestCase):
raw.update(metadata)
self.__dict__['raw'] = raw
+ def __getattr__(self, key):
+ try:
+ return self.__dict__['raw'][key]
+ except KeyError:
+ raise AttributeError(key)
+
+ def __setattr__(self, key, value):
+ try:
+ self.__dict__['raw'][key] = value
+ except KeyError:
+ raise AttributeError(key)
+
metadata = {
'id': 1,
'created_at': NOW_DATETIME,