diff options
| author | Josh Kearney <josh@jk0.org> | 2011-09-20 15:21:06 -0500 |
|---|---|---|
| committer | Josh Kearney <josh@jk0.org> | 2011-09-20 15:21:06 -0500 |
| commit | c07b24cdd6606950b0a4fef730c277b499eb65f4 (patch) | |
| tree | cad418eadab027ee2285840233f62b58cb2d8b46 /nova/tests | |
| parent | 13e346df0bc88279242ed1c56ad39b36a22c8a39 (diff) | |
Fixed unit tests with some minor refactoring.
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/api/openstack/test_images.py | 102 |
1 files changed, 96 insertions, 6 deletions
diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index 7053db37d..c0a246a91 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -30,18 +30,15 @@ import stubout import webob from nova import context -from nova import flags import nova.api.openstack from nova.api.openstack import images from nova.api.openstack import xmlutil from nova.api.openstack.views import images as images_view from nova import test +from nova import utils from nova.tests.api.openstack import fakes -FLAGS = flags.FLAGS - - NS = "{http://docs.openstack.org/compute/api/v1.1}" ATOMNS = "{http://www.w3.org/2005/Atom}" NOW_API_FORMAT = "2010-10-11T10:30:22Z" @@ -124,6 +121,7 @@ class ImagesTest(test.TestCase): href = "http://localhost/v1.1/fake/images/124" bookmark = "http://localhost/fake/images/124" + alternate = "%s/fake/images/124" % utils.generate_glance_url() server_href = "http://localhost/v1.1/servers/42" server_bookmark = "http://localhost/servers/42" @@ -157,6 +155,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": bookmark, + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": alternate }], }, } @@ -294,6 +297,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/123", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/123" % + utils.generate_glance_url() + }, ], }, { @@ -308,6 +317,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/124", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/124" % + utils.generate_glance_url() + }, ], }, { @@ -322,6 +337,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/125", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/125" % + utils.generate_glance_url() + }, ], }, { @@ -336,6 +357,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/126", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/126" % + utils.generate_glance_url() + }, ], }, { @@ -350,6 +377,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/127", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/127" % + utils.generate_glance_url() + }, ], }, { @@ -364,6 +397,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/128", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/128" % + utils.generate_glance_url() + }, ], }, { @@ -378,6 +417,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/129", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/129" % + utils.generate_glance_url() + }, ], }, { @@ -392,6 +437,12 @@ class ImagesTest(test.TestCase): "rel": "bookmark", "href": "http://localhost/fake/images/130", }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/130" % + utils.generate_glance_url() + }, ], }, ] @@ -498,6 +549,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/123", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/123" % utils.generate_glance_url() }], }, { @@ -529,6 +585,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/124", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/124" % utils.generate_glance_url() }], }, { @@ -560,6 +621,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/125", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/125" % utils.generate_glance_url() }], }, { @@ -591,6 +657,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/126", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/126" % utils.generate_glance_url() }], }, { @@ -622,6 +693,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/127", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/127" % utils.generate_glance_url() }], }, { @@ -653,6 +729,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/128", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/128" % utils.generate_glance_url() }], }, { @@ -684,6 +765,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/129", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/129" % utils.generate_glance_url() }], }, { @@ -701,6 +787,11 @@ class ImagesTest(test.TestCase): { "rel": "bookmark", "href": "http://localhost/fake/images/130", + }, + { + "rel": "alternate", + "type": "application/vnd.openstack.image", + "href": "%s/fake/images/130" % utils.generate_glance_url() }], }, ] @@ -973,8 +1064,7 @@ class ImagesTest(test.TestCase): # when supported in glance. view = images_view.ViewBuilderV11(1) generated_url = view.generate_alternate(1) - actual_url = "http://%s:%d//images/1" % (FLAGS.glance_host, - FLAGS.glance_port) + actual_url = "%s//images/1" % utils.generate_glance_url() self.assertEqual(generated_url, actual_url) |
