From 9f4d64a1bfbf42dec0d872b1045d8adbc7f19623 Mon Sep 17 00:00:00 2001 From: Pavel Kholkin <pkholkin@mirantis.com> Date: Mon, 2 Mar 2015 19:00:53 +0300 Subject: [PATCH] Cleanup in test_images and image_fakes Unused code was removed in fixture_data/images.py for unknown image requests that relate to v2/images.py and test_images for them. Change-Id: I7e31a572116b1e5cf0df9f431f8e53470d27d066 --- novaclient/tests/unit/fixture_data/images.py | 29 +------------------- novaclient/tests/unit/v2/test_images.py | 1 + 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/novaclient/tests/unit/fixture_data/images.py b/novaclient/tests/unit/fixture_data/images.py index 02f359668..4ec472581 100644 --- a/novaclient/tests/unit/fixture_data/images.py +++ b/novaclient/tests/unit/fixture_data/images.py @@ -67,25 +67,6 @@ class V1(base.Fixture): json={'image': image_1}, headers=headers) - self.requests.register_uri('GET', self.url(2), - json={'image': image_2}, - headers=headers) - - self.requests.register_uri('GET', self.url(456), - json={'image': image_2}, - headers=headers) - - def post_images(request, context): - body = jsonutils.loads(request.body) - assert list(body) == ['image'] - fakes.assert_has_keys(body['image'], required=['serverId', 'name']) - return images_1 - - self.requests.register_uri('POST', self.url(), - json=post_images, - headers=headers, - status_code=202) - def post_images_1_metadata(request, context): body = jsonutils.loads(request.body) assert list(body) == ['metadata'] @@ -96,17 +77,9 @@ class V1(base.Fixture): json=post_images_1_metadata, headers=headers) - for u in (1, 2, '1/metadata/test_key'): + for u in (1, '1/metadata/test_key'): self.requests.register_uri('DELETE', self.url(u), status_code=204) - image_headers = {'x-image-meta-id': '1', - 'x-image-meta-name': 'CentOS 5.2', - 'x-image-meta-updated': '2010-10-10T12:00:00Z', - 'x-image-meta-created': '2010-10-10T12:00:00Z', - 'x-image-meta-status': 'ACTIVE', - 'x-image-meta-property-test-key': 'test_value'} - self.requests.register_uri('HEAD', self.url(1), headers=image_headers) - class V3(V1): diff --git a/novaclient/tests/unit/v2/test_images.py b/novaclient/tests/unit/v2/test_images.py index 1f8104edb..0cd110fb5 100644 --- a/novaclient/tests/unit/v2/test_images.py +++ b/novaclient/tests/unit/v2/test_images.py @@ -26,6 +26,7 @@ class ImagesTest(utils.FixturedTestCase): il = self.cs.images.list() self.assert_called('GET', '/images/detail') [self.assertIsInstance(i, images.Image) for i in il] + self.assertEqual(2, len(il)) def test_list_images_undetailed(self): il = self.cs.images.list(detailed=False)