fix pep8 issues
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user