summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-03-27 00:07:25 +0000
committerGerrit Code Review <review@openstack.org>2012-03-27 00:07:25 +0000
commit2483dbfe42a43ce372876afbd7c40c3c8daede6f (patch)
tree3ff52744b11d1290f424126c5873336a4eb6cc0b /nova/tests
parenta003e45af56e4f4c197c40fedc3b7d19a9684132 (diff)
parent42585a3b2559329f0e563bcd04ff6c8c19115439 (diff)
Merge "Handle Forbidden and NotAuthenticated glance exc."
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/image/test_glance.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py
index d41e87423..bc5969a45 100644
--- a/nova/tests/image/test_glance.py
+++ b/nova/tests/image/test_glance.py
@@ -556,6 +556,19 @@ class TestGlanceImageService(test.TestCase):
self.flags(glance_num_retries=1)
service.get(self.context, image_id, writer)
+ def test_client_raises_forbidden(self):
+ class MyGlanceStubClient(glance_stubs.StubGlanceClient):
+ """A client that fails the first time, then succeeds."""
+ def get_image(self, image_id):
+ raise glance_exception.Forbidden()
+
+ client = MyGlanceStubClient()
+ service = glance.GlanceImageService(client=client)
+ image_id = 1 # doesn't matter
+ writer = NullWriter()
+ self.assertRaises(exception.ImageNotAuthorized, service.get,
+ self.context, image_id, writer)
+
def test_glance_client_image_id(self):
fixture = self._make_fixture(name='test image')
image_id = self.service.create(self.context, fixture)['id']