From 3fa4ece45eea12f0923c55d87130c668bafd2751 Mon Sep 17 00:00:00 2001 From: William Wolf Date: Wed, 1 Jun 2011 10:31:53 -0400 Subject: [PATCH] fix pep8 issues --- nova/api/openstack/common.py | 4 ++-- nova/tests/api/openstack/fakes.py | 13 ++++++++----- nova/tests/api/openstack/test_common.py | 6 +++--- nova/tests/api/openstack/test_images.py | 16 +++++++--------- nova/tests/api/openstack/test_servers.py | 3 +-- nova/tests/integrated/test_servers.py | 9 +++------ 6 files changed, 24 insertions(+), 27 deletions(-) diff --git a/nova/api/openstack/common.py b/nova/api/openstack/common.py index 69877cbce258..b0d368dfaa75 100644 --- a/nova/api/openstack/common.py +++ b/nova/api/openstack/common.py @@ -39,13 +39,13 @@ XML_NS_V11 = 'http://docs.openstack.org/compute/api/v1.1' def get_pagination_params(request): """ Return marker, limit tuple from request - + @param request: `wsgi.Request` possibly containing 'marker' and 'limit' GET variables. 'marker' is the id of the last element the client has seen, and 'limit' is the maximum number of items to return. If 'limit' is not specified, 0, or > max_limit, we default to max_limit. Negative values - for either marker or limit will cause + for either marker or limit will cause exc.HTTPBadRequest() exceptions to be raised. """ try: diff --git a/nova/tests/api/openstack/fakes.py b/nova/tests/api/openstack/fakes.py index 6395280fd7f1..bc21d66b4dd5 100644 --- a/nova/tests/api/openstack/fakes.py +++ b/nova/tests/api/openstack/fakes.py @@ -168,8 +168,10 @@ def stub_out_glance(stubs, initial_fixtures=None): def fake_get_images(self, filters=None, marker=None, limit=None): found = True - if marker: found = False - if limit == 0: limit = None + if marker: + found = False + if limit == 0: + limit = None fixtures = [] count = 0 @@ -188,8 +190,10 @@ def stub_out_glance(stubs, initial_fixtures=None): def fake_get_images_detailed(self, filters=None, marker=None, limit=None): found = True - if marker: found = False - if limit == 0: limit = None + if marker: + found = False + if limit == 0: + limit = None fixtures = [] count = 0 @@ -202,7 +206,6 @@ def stub_out_glance(stubs, initial_fixtures=None): if f['id'] == marker: found = True - return fixtures def fake_get_image_meta(self, image_id): diff --git a/nova/tests/api/openstack/test_common.py b/nova/tests/api/openstack/test_common.py index 34597c7acae3..55142ffe1484 100644 --- a/nova/tests/api/openstack/test_common.py +++ b/nova/tests/api/openstack/test_common.py @@ -174,8 +174,8 @@ class LimiterTest(test.TestCase): class PaginationParamsTest(test.TestCase): """ - Unit tests for the `nova.api.openstack.common.get_pagination_params` - method which takes in a request object and returns 'marker' and 'limit' + Unit tests for the `nova.api.openstack.common.get_pagination_params` + method which takes in a request object and returns 'marker' and 'limit' GET params. """ @@ -185,7 +185,7 @@ class PaginationParamsTest(test.TestCase): """ req = Request.blank('/') self.assertEqual(get_pagination_params(req), (0, 0)) - + def test_valid_marker(self): """ Test valid marker param. diff --git a/nova/tests/api/openstack/test_images.py b/nova/tests/api/openstack/test_images.py index c859a31dee97..667f2866bc88 100644 --- a/nova/tests/api/openstack/test_images.py +++ b/nova/tests/api/openstack/test_images.py @@ -238,7 +238,7 @@ class GlanceImageServiceTest(_BaseImageServiceTests): image_metas = self.service.index(self.context) i = 0 for meta in image_metas: - expected = {'id': 'DONTCARE', + expected = {'id': 'DONTCARE', 'name': 'TestImage %d' % (i)} self.assertDictMatch(meta, expected) i = i + 1 @@ -255,7 +255,7 @@ class GlanceImageServiceTest(_BaseImageServiceTests): self.assertEquals(len(image_metas), 8) i = 2 for meta in image_metas: - expected = {'id': 'DONTCARE', + expected = {'id': 'DONTCARE', 'name': 'TestImage %d' % (i)} self.assertDictMatch(meta, expected) i = i + 1 @@ -283,7 +283,7 @@ class GlanceImageServiceTest(_BaseImageServiceTests): self.assertEquals(len(image_metas), 1) i = 4 for meta in image_metas: - expected = {'id': 'DONTCARE', + expected = {'id': 'DONTCARE', 'name': 'TestImage %d' % (i)} self.assertDictMatch(meta, expected) i = i + 1 @@ -301,9 +301,8 @@ class GlanceImageServiceTest(_BaseImageServiceTests): i = 2 for meta in image_metas: expected = {'id': 'DONTCARE', 'status': None, - 'is_public': True, 'properties':{ - 'updated': None, 'created': None - }, + 'is_public': True, 'properties': { + 'updated': None, 'created': None}, 'name': 'TestImage %d' % (i)} self.assertDictMatch(meta, expected) i = i + 1 @@ -332,9 +331,8 @@ class GlanceImageServiceTest(_BaseImageServiceTests): i = 4 for meta in image_metas: expected = {'id': 'DONTCARE', 'status': None, - 'is_public': True, 'properties':{ - 'updated': None, 'created': None - }, + 'is_public': True, 'properties': { + 'updated': None, 'created': None}, 'name': 'TestImage %d' % (i)} self.assertDictMatch(meta, expected) i = i + 1 diff --git a/nova/tests/api/openstack/test_servers.py b/nova/tests/api/openstack/test_servers.py index fbde5c9ced9d..20379e2bdc09 100644 --- a/nova/tests/api/openstack/test_servers.py +++ b/nova/tests/api/openstack/test_servers.py @@ -774,8 +774,7 @@ class ServersTest(test.TestCase): def server_update(context, id, params): filtered_dict = dict( - display_name='server_test' - ) + display_name='server_test') self.assertEqual(params, filtered_dict) return filtered_dict diff --git a/nova/tests/integrated/test_servers.py b/nova/tests/integrated/test_servers.py index a67fa1bb596b..35c6bb34f771 100644 --- a/nova/tests/integrated/test_servers.py +++ b/nova/tests/integrated/test_servers.py @@ -194,8 +194,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase): post = {} post['rebuild'] = { "imageRef": "https://localhost/v1.1/32278/images/2", - "name": "blah" - } + "name": "blah"} self.api.post_server_action(created_server_id, post) LOG.debug("rebuilt server: %s" % created_server) @@ -224,8 +223,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase): post = {} post['rebuild'] = { "imageRef": "https://localhost/v1.1/32278/images/2", - "name": "blah" - } + "name": "blah"} metadata = {} for i in range(30): @@ -267,8 +265,7 @@ class ServersTest(integrated_helpers._IntegratedTestBase): post = {} post['rebuild'] = { "imageRef": "https://localhost/v1.1/32278/images/2", - "name": "blah" - } + "name": "blah"} metadata = {} post['rebuild']['metadata'] = metadata