summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorChristopher MacGown <chris@pistoncloud.com>2011-09-01 12:05:21 -0700
committerChristopher MacGown <chris@pistoncloud.com>2011-09-01 12:05:21 -0700
commitdd5eeafbfe1013fd9acdb119933cb5bf986706e6 (patch)
tree6700654467ce0a58a7137652c518d54308ff1860 /nova
parent2cf0b67e08e1608bd717ffadd41d5029db2b4a3a (diff)
downloadnova-dd5eeafbfe1013fd9acdb119933cb5bf986706e6.tar.gz
nova-dd5eeafbfe1013fd9acdb119933cb5bf986706e6.tar.xz
nova-dd5eeafbfe1013fd9acdb119933cb5bf986706e6.zip
Adds test for image.glance.GlanceImageService._is_image_available
Diffstat (limited to 'nova')
-rw-r--r--nova/tests/image/test_glance.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py
index 0ff508ffa..81a54346e 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
@@ -96,6 +97,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': {'name': 'image1', 'is_public': True,
'foo': 'bar',