Fix order of arguments in assertEqual

Fix incorrect order assertEqual(observed, expected) as below.
  assertEqual(observed, expected) => assertEqual(expected, observed)

Target of this patch:
  manila/tests/scheduler/*
  manila/tests/volume/*
  and all others

Change-Id: I063d35c01835ed6a5c62f016274b02e29333aade
Closes-Bug: #1280522
changes/33/232333/1
Yusuke Hayashi 7 years ago
parent 34274c9abd
commit d24048aff4
  1. 10
      manila/tests/api/v1/test_share_snapshots.py
  2. 2
      manila/tests/scheduler/test_host_manager.py
  3. 6
      manila/tests/scheduler/test_rpcapi.py
  4. 2
      manila/tests/scheduler/test_scheduler.py
  5. 10
      manila/tests/volume/test_cinder.py

@ -340,7 +340,7 @@ class ShareSnapshotApiTest(test.TestCase):
},
]
}
self.assertEqual(res_dict, expected)
self.assertEqual(expected, res_dict)
def test_snapshot_updates_description(self):
snp = self.snp_example
@ -348,7 +348,7 @@ class ShareSnapshotApiTest(test.TestCase):
req = fakes.HTTPRequest.blank('/snapshot/1')
res_dict = self.controller.update(req, 1, body)
self.assertEqual(res_dict['snapshot']["name"], snp["display_name"])
self.assertEqual(snp["display_name"], res_dict['snapshot']["name"])
def test_snapshot_updates_display_descr(self):
snp = self.snp_example
@ -357,8 +357,8 @@ class ShareSnapshotApiTest(test.TestCase):
req = fakes.HTTPRequest.blank('/snapshot/1')
res_dict = self.controller.update(req, 1, body)
self.assertEqual(res_dict['snapshot']["description"],
snp["display_description"])
self.assertEqual(snp["display_description"],
res_dict['snapshot']["description"])
def test_share_not_updates_size(self):
snp = self.snp_example
@ -367,4 +367,4 @@ class ShareSnapshotApiTest(test.TestCase):
req = fakes.HTTPRequest.blank('/snapshot/1')
res_dict = self.controller.update(req, 1, body)
self.assertNotEqual(res_dict['snapshot']["size"], snp["size"])
self.assertNotEqual(snp["size"], res_dict['snapshot']["size"])

@ -77,7 +77,7 @@ class HostManagerTestCase(test.TestCase):
for x in info['got_fprops']:
self.assertEqual(info['expected_fprops'], x)
self.assertEqual(set(info['expected_objs']), set(info['got_objs']))
self.assertEqual(set(result), set(info['got_objs']))
self.assertEqual(set(info['got_objs']), set(result))
def test_get_filtered_hosts(self):
fake_properties = {'moo': 1, 'cow': 2}

@ -52,7 +52,7 @@ class SchedulerRpcAPITestCase(test.TestCase):
def _fake_prepare_method(*args, **kwds):
for kwd in kwds:
self.assertEqual(kwds[kwd], target[kwd])
self.assertEqual(target[kwd], kwds[kwd])
return rpcapi.client
def _fake_rpc_method(*args, **kwargs):
@ -67,10 +67,10 @@ class SchedulerRpcAPITestCase(test.TestCase):
with mock.patch.object(rpcapi.client, rpc_method) as mock_method:
mock_method.side_effect = _fake_rpc_method
retval = getattr(rpcapi, method)(ctxt, **kwargs)
self.assertEqual(retval, expected_retval)
self.assertEqual(expected_retval, retval)
expected_args = [ctxt, method, expected_msg]
for arg, expected_arg in zip(self.fake_args, expected_args):
self.assertEqual(arg, expected_arg)
self.assertEqual(expected_arg, arg)
def test_update_service_capabilities(self):
self._test_scheduler_api('update_service_capabilities',

@ -216,7 +216,7 @@ class SchedulerTestCase(test.TestCase):
with mock.patch.object(utils, 'service_is_up',
mock.Mock(side_effect=fake_service_is_up)):
result = self.driver.hosts_up(self.context, self.topic)
self.assertEqual(result, ['host2'])
self.assertEqual(['host2'], result)
db.service_get_all_by_topic.assert_called_once_with(
self.context, self.topic)

@ -59,7 +59,7 @@ class CinderApiTestCase(test.TestCase):
def test_get(self):
volume_id = 'volume_id1'
result = self.api.get(self.ctx, volume_id)
self.assertEqual(result['id'], volume_id)
self.assertEqual(volume_id, result['id'])
@ddt.data(
{'cinder_e': cinder_exception.NotFound(404),
@ -75,7 +75,7 @@ class CinderApiTestCase(test.TestCase):
def test_create(self):
result = self.api.create(self.ctx, 1, '', '')
self.assertEqual(result['id'], 'created_id')
self.assertEqual('created_id', result['id'])
def test_create_failed(self):
cinder.cinderclient.side_effect = cinder_exception.BadRequest(400)
@ -203,7 +203,7 @@ class CinderApiTestCase(test.TestCase):
def test_get_snapshot(self):
snapshot_id = 'snapshot_id1'
result = self.api.get_snapshot(self.ctx, snapshot_id)
self.assertEqual(result['id'], snapshot_id)
self.assertEqual(snapshot_id, result['id'])
def test_get_snapshot_failed(self):
cinder.cinderclient.side_effect = cinder_exception.NotFound(404)
@ -218,12 +218,12 @@ class CinderApiTestCase(test.TestCase):
def test_create_snapshot(self):
result = self.api.create_snapshot(self.ctx, {'id': 'id1'}, '', '')
self.assertEqual(result['id'], 'created_id')
self.assertEqual('created_id', result['id'])
def test_create_force(self):
result = self.api.create_snapshot_force(self.ctx,
{'id': 'id1'}, '', '')
self.assertEqual(result['id'], 'created_id')
self.assertEqual('created_id', result['id'])
def test_delete_snapshot(self):
self.mock_object(self.cinderclient.volume_snapshots, 'delete')

Loading…
Cancel
Save