diff options
| author | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2011-09-01 22:31:54 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-09-01 22:31:54 +0000 |
| commit | d80dc5bbbd1781bd33d9f69b608014e9cc2e41a3 (patch) | |
| tree | b1fdf33780308eac9ed579d171c7a537dafd6a39 /nova/tests | |
| parent | ce6f55b4bd889d9e873598bb23ed37327d75252e (diff) | |
| parent | 83a56a247cf026e4782b430c611adc2fc4158835 (diff) | |
Glance can now perform its own authentication/authorization checks when we're using keystone.
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/image/test_glance.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py index 5df25df37..b1ebd8436 100644 --- a/nova/tests/image/test_glance.py +++ b/nova/tests/image/test_glance.py @@ -20,6 +20,7 @@ import datetime import unittest from nova import context +from nova import exception from nova import test from nova.image import glance @@ -105,6 +106,31 @@ class TestGlanceImageServiceProperties(BaseGlanceTest): 'properties': {'prop1': 'propvalue1', 'foo': 'bar'}} self.assertEqual(image_meta, expected) + def test_show_raises_when_no_authtoken_in_the_context(self): + fixtures = {'image1': {'name': 'image1', 'is_public': False, + 'foo': 'bar', + 'properties': {'prop1': 'propvalue1'}}} + self.client.images = fixtures + self.context.auth_token = False + + expected = {'name': 'image1', 'is_public': True, + 'properties': {'prop1': 'propvalue1', 'foo': 'bar'}} + self.assertRaises(exception.ImageNotFound, + self.service.show, self.context, 'image1') + + def test_show_passes_through_to_client_with_authtoken_in_context(self): + fixtures = {'image1': {'name': 'image1', 'is_public': False, + 'foo': 'bar', + 'properties': {'prop1': 'propvalue1'}}} + self.client.images = fixtures + self.context.auth_token = True + + expected = {'name': 'image1', 'is_public': False, + 'properties': {'prop1': 'propvalue1', 'foo': 'bar'}} + + image_meta = self.service.show(self.context, 'image1') + self.assertEqual(image_meta, expected) + def test_detail_passes_through_to_client(self): fixtures = {'image1': {'id': '1', 'name': 'image1', 'is_public': True, 'foo': 'bar', |
