Browse Source

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
tags/2.0.0.0b1
Yusuke Hayashi 3 years ago
parent
commit
d24048aff4

+ 5
- 5
manila/tests/api/v1/test_share_snapshots.py View File

@@ -340,7 +340,7 @@ class ShareSnapshotApiTest(test.TestCase):
340 340
                 },
341 341
             ]
342 342
         }
343
-        self.assertEqual(res_dict, expected)
343
+        self.assertEqual(expected, res_dict)
344 344
 
345 345
     def test_snapshot_updates_description(self):
346 346
         snp = self.snp_example
@@ -348,7 +348,7 @@ class ShareSnapshotApiTest(test.TestCase):
348 348
 
349 349
         req = fakes.HTTPRequest.blank('/snapshot/1')
350 350
         res_dict = self.controller.update(req, 1, body)
351
-        self.assertEqual(res_dict['snapshot']["name"], snp["display_name"])
351
+        self.assertEqual(snp["display_name"], res_dict['snapshot']["name"])
352 352
 
353 353
     def test_snapshot_updates_display_descr(self):
354 354
         snp = self.snp_example
@@ -357,8 +357,8 @@ class ShareSnapshotApiTest(test.TestCase):
357 357
         req = fakes.HTTPRequest.blank('/snapshot/1')
358 358
         res_dict = self.controller.update(req, 1, body)
359 359
 
360
-        self.assertEqual(res_dict['snapshot']["description"],
361
-                         snp["display_description"])
360
+        self.assertEqual(snp["display_description"],
361
+                         res_dict['snapshot']["description"])
362 362
 
363 363
     def test_share_not_updates_size(self):
364 364
         snp = self.snp_example
@@ -367,4 +367,4 @@ class ShareSnapshotApiTest(test.TestCase):
367 367
         req = fakes.HTTPRequest.blank('/snapshot/1')
368 368
         res_dict = self.controller.update(req, 1, body)
369 369
 
370
-        self.assertNotEqual(res_dict['snapshot']["size"], snp["size"])
370
+        self.assertNotEqual(snp["size"], res_dict['snapshot']["size"])

+ 1
- 1
manila/tests/scheduler/test_host_manager.py View File

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

+ 3
- 3
manila/tests/scheduler/test_rpcapi.py View File

@@ -52,7 +52,7 @@ class SchedulerRpcAPITestCase(test.TestCase):
52 52
 
53 53
         def _fake_prepare_method(*args, **kwds):
54 54
             for kwd in kwds:
55
-                self.assertEqual(kwds[kwd], target[kwd])
55
+                self.assertEqual(target[kwd], kwds[kwd])
56 56
             return rpcapi.client
57 57
 
58 58
         def _fake_rpc_method(*args, **kwargs):
@@ -67,10 +67,10 @@ class SchedulerRpcAPITestCase(test.TestCase):
67 67
             with mock.patch.object(rpcapi.client, rpc_method) as mock_method:
68 68
                 mock_method.side_effect = _fake_rpc_method
69 69
                 retval = getattr(rpcapi, method)(ctxt, **kwargs)
70
-                self.assertEqual(retval, expected_retval)
70
+                self.assertEqual(expected_retval, retval)
71 71
                 expected_args = [ctxt, method, expected_msg]
72 72
                 for arg, expected_arg in zip(self.fake_args, expected_args):
73
-                    self.assertEqual(arg, expected_arg)
73
+                    self.assertEqual(expected_arg, arg)
74 74
 
75 75
     def test_update_service_capabilities(self):
76 76
         self._test_scheduler_api('update_service_capabilities',

+ 1
- 1
manila/tests/scheduler/test_scheduler.py View File

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

+ 5
- 5
manila/tests/volume/test_cinder.py View File

@@ -59,7 +59,7 @@ class CinderApiTestCase(test.TestCase):
59 59
     def test_get(self):
60 60
         volume_id = 'volume_id1'
61 61
         result = self.api.get(self.ctx, volume_id)
62
-        self.assertEqual(result['id'], volume_id)
62
+        self.assertEqual(volume_id, result['id'])
63 63
 
64 64
     @ddt.data(
65 65
         {'cinder_e': cinder_exception.NotFound(404),
@@ -75,7 +75,7 @@ class CinderApiTestCase(test.TestCase):
75 75
 
76 76
     def test_create(self):
77 77
         result = self.api.create(self.ctx, 1, '', '')
78
-        self.assertEqual(result['id'], 'created_id')
78
+        self.assertEqual('created_id', result['id'])
79 79
 
80 80
     def test_create_failed(self):
81 81
         cinder.cinderclient.side_effect = cinder_exception.BadRequest(400)
@@ -203,7 +203,7 @@ class CinderApiTestCase(test.TestCase):
203 203
     def test_get_snapshot(self):
204 204
         snapshot_id = 'snapshot_id1'
205 205
         result = self.api.get_snapshot(self.ctx, snapshot_id)
206
-        self.assertEqual(result['id'], snapshot_id)
206
+        self.assertEqual(snapshot_id, result['id'])
207 207
 
208 208
     def test_get_snapshot_failed(self):
209 209
         cinder.cinderclient.side_effect = cinder_exception.NotFound(404)
@@ -218,12 +218,12 @@ class CinderApiTestCase(test.TestCase):
218 218
 
219 219
     def test_create_snapshot(self):
220 220
         result = self.api.create_snapshot(self.ctx, {'id': 'id1'}, '', '')
221
-        self.assertEqual(result['id'], 'created_id')
221
+        self.assertEqual('created_id', result['id'])
222 222
 
223 223
     def test_create_force(self):
224 224
         result = self.api.create_snapshot_force(self.ctx,
225 225
                                                 {'id': 'id1'}, '', '')
226
-        self.assertEqual(result['id'], 'created_id')
226
+        self.assertEqual('created_id', result['id'])
227 227
 
228 228
     def test_delete_snapshot(self):
229 229
         self.mock_object(self.cinderclient.volume_snapshots, 'delete')

Loading…
Cancel
Save