From 257da8a0e5fd949f62232bf2eef9d91f36fc41ce Mon Sep 17 00:00:00 2001 From: Trey Morris Date: Thu, 23 Dec 2010 23:09:58 +0000 Subject: fixed the os api image test for glance --- nova/tests/api/openstack/test_images.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index f610cbf9c..e849b5ea6 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -223,6 +223,21 @@ class ImageControllerWithGlanceServiceTest(unittest.TestCase): res = req.get_response(nova.api.API('os')) res_dict = json.loads(res.body) + def _is_equivalent_subset(x, y): + if set(x) <= set(y): + for k, v in x.iteritems(): + if x[k] != y[k]: + return False + return True + return False + for image in res_dict['images']: - self.assertEquals(1, self.IMAGE_FIXTURES.count(image), - "image %s not in fixtures!" % str(image)) + for image_fixture in IMAGE_FIXTURES: + if _is_equivalent_subset(image, image_fixture): + break + else: + self.assertFalse("image %s not in fixtures!" % str(image)) + +# for image in res_dict['images']: +# self.assertEquals(1, self.IMAGE_FIXTURES.count(image), +# "image %s not in fixtures!" % str(image)) -- cgit