diff options
| author | Anthony Young <sleepsonthefloor@gmail.com> | 2012-03-26 14:50:17 -0700 |
|---|---|---|
| committer | Anthony Young <sleepsonthefloor@gmail.com> | 2012-03-26 14:52:33 -0700 |
| commit | 42585a3b2559329f0e563bcd04ff6c8c19115439 (patch) | |
| tree | f6946ac13e8873b236afe8a8f1566a9aac1bb686 /nova/tests | |
| parent | 81587ba245c0929944e1edaf79909b5070c9a92e (diff) | |
Handle Forbidden and NotAuthenticated glance exc.
* Remove references to deprecated NotAuthorized exception
* Handle Forbidden and NotAuthenticated
* Fixes bug 965540
Change-Id: Ib5eef3015239e0fafdb01c975a0f5d553f70519e
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/image/test_glance.py | 13 |
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'] |
