Use correct order of arguments to assertEqual
The correct order of arguments to assertEqual that is expected by testtools is (expected, observed). This patch fixes the inverted usage of arguments in some places that have cropped up since the last fix of this bug. Change-Id: If8c0dcb58496bc2fcf4c635f384522a1f7d2b2af Closes-Bug: #1259292
This commit is contained in:
parent
46c3792fee
commit
c3de38ed53
|
@ -237,7 +237,7 @@ class TestClient(testtools.TestCase):
|
|||
def test_get_connections_kwargs_http(self):
|
||||
endpoint = 'http://example.com:9292'
|
||||
test_client = http.HTTPClient(endpoint, token=u'adc123')
|
||||
self.assertEqual(test_client.timeout, 600.0)
|
||||
self.assertEqual(600.0, test_client.timeout)
|
||||
|
||||
def test_http_chunked_request(self):
|
||||
text = "Ok"
|
||||
|
|
|
@ -695,7 +695,7 @@ class ShellTestWithNoOSImageURLPublic(ShellTestWithKeystoneV3Auth):
|
|||
glance_shell.main(args.split())
|
||||
assert v2_client.called
|
||||
(args, kwargs) = v2_client.call_args
|
||||
self.assertEqual(kwargs['endpoint_override'], self.image_url)
|
||||
self.assertEqual(self.image_url, kwargs['endpoint_override'])
|
||||
|
||||
def test_endpoint_real_from_interface(self):
|
||||
args = ('--os-image-api-version 2 image-list')
|
||||
|
@ -843,4 +843,4 @@ class ShellCacheSchemaTest(testutils.TestCase):
|
|||
switch_version = self.shell._cache_schemas(self._make_args(options),
|
||||
client,
|
||||
home_dir=self.cache_dir)
|
||||
self.assertEqual(switch_version, True)
|
||||
self.assertEqual(True, switch_version)
|
||||
|
|
|
@ -669,8 +669,8 @@ class ImageManagerTest(testtools.TestCase):
|
|||
'x-image-meta-property-c': 'd',
|
||||
}
|
||||
expect = [('POST', '/v1/images', expect_headers, None)]
|
||||
self.assertEqual(self.api.calls, expect)
|
||||
self.assertEqual(image.id, '1')
|
||||
self.assertEqual(expect, self.api.calls)
|
||||
self.assertEqual('1', image.id)
|
||||
expect_req_id = ['req-1234']
|
||||
self.assertEqual(expect_req_id, params['return_req_id'])
|
||||
|
||||
|
@ -738,7 +738,7 @@ class ImageManagerTest(testtools.TestCase):
|
|||
self.mgr.update('4', **fields)
|
||||
expect_headers = {'x-glance-registry-purge-props': 'true'}
|
||||
expect = [('PUT', '/v1/images/4', expect_headers, None)]
|
||||
self.assertEqual(self.api.calls, expect)
|
||||
self.assertEqual(expect, self.api.calls)
|
||||
expect_req_id = ['req-1234']
|
||||
self.assertEqual(expect_req_id, fields['return_req_id'])
|
||||
|
||||
|
@ -765,7 +765,7 @@ class ImageManagerTest(testtools.TestCase):
|
|||
}
|
||||
images = self.mgr.list(**fields)
|
||||
next(images)
|
||||
self.assertEqual(fields['return_req_id'], ['req-1234'])
|
||||
self.assertEqual(['req-1234'], fields['return_req_id'])
|
||||
|
||||
def test_image_list_with_notfound_owner(self):
|
||||
images = self.mgr.list(owner='X', page_size=20)
|
||||
|
|
|
@ -1056,10 +1056,8 @@ class TestController(testtools.TestCase):
|
|||
new_loc = {'url': 'http://spam.com/', 'metadata': {'spam': 'ham'}}
|
||||
add_patch = {'path': '/locations/-', 'value': new_loc, 'op': 'add'}
|
||||
self.controller.add_location(image_id, **new_loc)
|
||||
self.assertEqual(self.api.calls, [
|
||||
self._patch_req(image_id, [add_patch]),
|
||||
self._empty_get(image_id)
|
||||
])
|
||||
self.assertEqual([self._patch_req(image_id, [add_patch]),
|
||||
self._empty_get(image_id)], self.api.calls)
|
||||
|
||||
@mock.patch.object(images.Controller, '_send_image_update_request',
|
||||
side_effect=exc.HTTPBadRequest)
|
||||
|
@ -1077,10 +1075,9 @@ class TestController(testtools.TestCase):
|
|||
del_patches = [{'path': '/locations/1', 'op': 'remove'},
|
||||
{'path': '/locations/0', 'op': 'remove'}]
|
||||
self.controller.delete_locations(image_id, url_set)
|
||||
self.assertEqual(self.api.calls, [
|
||||
self._empty_get(image_id),
|
||||
self._patch_req(image_id, del_patches)
|
||||
])
|
||||
self.assertEqual([self._empty_get(image_id),
|
||||
self._patch_req(image_id, del_patches)],
|
||||
self.api.calls)
|
||||
|
||||
def test_remove_missing_location(self):
|
||||
image_id = 'a2b83adc-888e-11e3-8872-78acc0b951d8'
|
||||
|
@ -1102,11 +1099,10 @@ class TestController(testtools.TestCase):
|
|||
mod_patch = [{'path': '/locations', 'op': 'replace',
|
||||
'value': list(loc_map.values())}]
|
||||
self.controller.update_location(image_id, **new_loc)
|
||||
self.assertEqual(self.api.calls, [
|
||||
self._empty_get(image_id),
|
||||
self._patch_req(image_id, mod_patch),
|
||||
self._empty_get(image_id)
|
||||
])
|
||||
self.assertEqual([self._empty_get(image_id),
|
||||
self._patch_req(image_id, mod_patch),
|
||||
self._empty_get(image_id)],
|
||||
self.api.calls)
|
||||
|
||||
def test_update_tags(self):
|
||||
image_id = 'a2b83adc-888e-11e3-8872-78acc0b951d8'
|
||||
|
|
|
@ -257,45 +257,45 @@ class TestController(testtools.TestCase):
|
|||
def test_list_tasks(self):
|
||||
# NOTE(flwang): cast to list since the controller returns a generator
|
||||
tasks = list(self.controller.list())
|
||||
self.assertEqual(tasks[0].id, _PENDING_ID)
|
||||
self.assertEqual(tasks[0].type, 'import')
|
||||
self.assertEqual(tasks[0].status, 'pending')
|
||||
self.assertEqual(tasks[1].id, _PROCESSING_ID)
|
||||
self.assertEqual(tasks[1].type, 'import')
|
||||
self.assertEqual(tasks[1].status, 'processing')
|
||||
self.assertEqual(_PENDING_ID, tasks[0].id)
|
||||
self.assertEqual('import', tasks[0].type)
|
||||
self.assertEqual('pending', tasks[0].status)
|
||||
self.assertEqual(_PROCESSING_ID, tasks[1].id)
|
||||
self.assertEqual('import', tasks[1].type)
|
||||
self.assertEqual('processing', tasks[1].status)
|
||||
|
||||
def test_list_tasks_paginated(self):
|
||||
# NOTE(flwang): cast to list since the controller returns a generator
|
||||
tasks = list(self.controller.list(page_size=1))
|
||||
self.assertEqual(tasks[0].id, _PENDING_ID)
|
||||
self.assertEqual(tasks[0].type, 'import')
|
||||
self.assertEqual(tasks[1].id, _PROCESSING_ID)
|
||||
self.assertEqual(tasks[1].type, 'import')
|
||||
self.assertEqual(_PENDING_ID, tasks[0].id)
|
||||
self.assertEqual('import', tasks[0].type)
|
||||
self.assertEqual(_PROCESSING_ID, tasks[1].id)
|
||||
self.assertEqual('import', tasks[1].type)
|
||||
|
||||
def test_list_tasks_with_status(self):
|
||||
filters = {'filters': {'status': 'processing'}}
|
||||
tasks = list(self.controller.list(**filters))
|
||||
self.assertEqual(tasks[0].id, _OWNED_TASK_ID)
|
||||
self.assertEqual(_OWNED_TASK_ID, tasks[0].id)
|
||||
|
||||
def test_list_tasks_with_wrong_status(self):
|
||||
filters = {'filters': {'status': 'fake'}}
|
||||
tasks = list(self.controller.list(**filters))
|
||||
self.assertEqual(len(tasks), 0)
|
||||
self.assertEqual(0, len(tasks))
|
||||
|
||||
def test_list_tasks_with_type(self):
|
||||
filters = {'filters': {'type': 'import'}}
|
||||
tasks = list(self.controller.list(**filters))
|
||||
self.assertEqual(tasks[0].id, _OWNED_TASK_ID)
|
||||
self.assertEqual(_OWNED_TASK_ID, tasks[0].id)
|
||||
|
||||
def test_list_tasks_with_wrong_type(self):
|
||||
filters = {'filters': {'type': 'fake'}}
|
||||
tasks = list(self.controller.list(**filters))
|
||||
self.assertEqual(len(tasks), 0)
|
||||
self.assertEqual(0, len(tasks))
|
||||
|
||||
def test_list_tasks_for_owner(self):
|
||||
filters = {'filters': {'owner': _OWNER_ID}}
|
||||
tasks = list(self.controller.list(**filters))
|
||||
self.assertEqual(tasks[0].id, _OWNED_TASK_ID)
|
||||
self.assertEqual(_OWNED_TASK_ID, tasks[0].id)
|
||||
|
||||
def test_list_tasks_for_fake_owner(self):
|
||||
filters = {'filters': {'owner': _FAKE_OWNER_ID}}
|
||||
|
@ -347,8 +347,8 @@ class TestController(testtools.TestCase):
|
|||
|
||||
def test_get_task(self):
|
||||
task = self.controller.get(_PENDING_ID)
|
||||
self.assertEqual(task.id, _PENDING_ID)
|
||||
self.assertEqual(task.type, 'import')
|
||||
self.assertEqual(_PENDING_ID, task.id)
|
||||
self.assertEqual('import', task.type)
|
||||
|
||||
def test_create_task(self):
|
||||
properties = {
|
||||
|
@ -357,8 +357,8 @@ class TestController(testtools.TestCase):
|
|||
'swift://cloud.foo/myaccount/mycontainer/path'},
|
||||
}
|
||||
task = self.controller.create(**properties)
|
||||
self.assertEqual(task.id, _PENDING_ID)
|
||||
self.assertEqual(task.type, 'import')
|
||||
self.assertEqual(_PENDING_ID, task.id)
|
||||
self.assertEqual('import', task.type)
|
||||
|
||||
def test_create_task_invalid_property(self):
|
||||
properties = {
|
||||
|
|
Loading…
Reference in New Issue