Skip to content

Commit

Permalink
test_glance.py: Stub out _get_member_model as well.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Adam Gandelman committed May 28, 2013
1 parent b782597 commit 1365ada
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cinder/tests/image/test_glance.py
Expand Up @@ -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"""
Expand Down

0 comments on commit 1365ada

Please sign in to comment.