]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
test_glance.py: Stub out _get_member_model as well.
authorAdam Gandelman <adamg@canonical.com>
Tue, 28 May 2013 21:34:30 +0000 (14:34 -0700)
committerAdam Gandelman <adamg@canonical.com>
Tue, 28 May 2013 23:11:04 +0000 (16:11 -0700)
glanceclient's v2 client needs to also have its _get_member_model()
stubbed out as well, to avoid attempts to reach 'fake_host' during
client instantiation.

Update: Only stub when _get_member_model() when required.

Change-Id: I943cbb017ccdbe4f6c994bc83cbefe8693f4672b
Fixes: bug #1185178.
cinder/tests/image/test_glance.py

index 46bbafa9c5dbb78b52b1f84faea571a3428326bc..116096f8e9975a29b9b5a12322e6a4995b502e26 100644 (file)
@@ -547,11 +547,18 @@ class TestGlanceClientVersion(test.TestCase):
     def setUp(self):
         super(TestGlanceClientVersion, self).setUp()
 
-        def fake_get_image_model(self):
+        def fake_get_model(self):
             return
 
         self.stubs.Set(glanceclient_v2, '_get_image_model',
-                       fake_get_image_model)
+                       fake_get_model)
+
+        try:
+            self.stubs.Set(glanceclient_v2, '_get_member_model',
+                           fake_get_model)
+        except AttributeError:
+            # method requires stubbing only with newer glanceclients.
+            pass
 
     def test_glance_version_by_flag(self):
         """Test glance version set by flag is honoured"""