summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJosh Kearney <josh@jk0.org>2011-09-20 12:41:23 -0500
committerJosh Kearney <josh@jk0.org>2011-09-20 12:41:23 -0500
commitbb018b14fb8786090b2cf8b23723fa97defef9ce (patch)
treed807fdcb2d70990d0956d643f9d414304250e503 /nova/tests
parent97602419375622006a20f81d0f83fd005c6816ac (diff)
Added function to construct a glance URL and unit test.
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/image/test_glance.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/tests/image/test_glance.py b/nova/tests/image/test_glance.py
index 290c9a04a..9f866d790 100644
--- a/nova/tests/image/test_glance.py
+++ b/nova/tests/image/test_glance.py
@@ -22,11 +22,15 @@ import stubout
from nova.tests.api.openstack import fakes
from nova import context
from nova import exception
+from nova import flags
from nova.image import glance
from nova import test
from nova.tests.glance import stubs as glance_stubs
+FLAGS = flags.FLAGS
+
+
class NullWriter(object):
"""Used to test ImageService.get which takes a writer object"""
@@ -451,3 +455,10 @@ class TestGlanceImageService(test.TestCase):
image_meta = self.service.get(self.context, image_id, writer)
self.assertEqual(image_meta['created_at'], self.NOW_DATETIME)
self.assertEqual(image_meta['updated_at'], self.NOW_DATETIME)
+
+ def test_contruct_glance_url(self):
+ # TODO(jk0): This will eventually need to take SSL into consideration
+ # when supported in glance.
+ generated_url = glance._construct_glance_url()
+ actual_url = "http://%s:%d" % (FLAGS.glance_host, FLAGS.glance_port)
+ self.assertEqual(generated_url, actual_url)