From bb018b14fb8786090b2cf8b23723fa97defef9ce Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Tue, 20 Sep 2011 12:41:23 -0500 Subject: Added function to construct a glance URL and unit test. --- nova/tests/image/test_glance.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'nova/tests') 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) -- cgit