]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Replace assertEqual(True, *) -> assertTrue(*)
authorKallebe Monteiro <kallebe.monteiro@lsbd.ufc.br>
Mon, 9 Mar 2015 19:05:36 +0000 (16:05 -0300)
committerKallebe Monteiro <kallebe.monteiro@lsbd.ufc.br>
Tue, 10 Mar 2015 11:23:17 +0000 (11:23 +0000)
Inspired by Dave Chen's change request on keystone about this, I
decided to check in cinder code to see if there were many cases.

Since unittest provides assertTrue and assertFalse, it is better
to use assertTrue(var) instead of assertEqual(True, var) and the same
thing applies to assertFalse.

I used these commands to search the occurrences:
* grep -PRIn "assertEqual\(True"
* grep -PRIn "assertEqual\(False"
* grep -PRIn "assertEqual\(\w+\s*,\s*True"
* grep -PRIn "assertEqual\(\w+\s*,\s*False"

Closes-Bug: #1430262

Change-Id: Ie92ce744d68a473b9ecc5214ed322bf2c5f5e000

15 files changed:
cinder/tests/brick/test_brick_connector.py
cinder/tests/image/test_glance.py
cinder/tests/test_dellscapi.py
cinder/tests/test_evaluator.py
cinder/tests/test_glusterfs.py
cinder/tests/test_gpfs.py
cinder/tests/test_hplefthand.py
cinder/tests/test_ibm_flashsystem.py
cinder/tests/test_ibmnas.py
cinder/tests/test_prophetstor_dpl.py
cinder/tests/test_smbfs.py
cinder/tests/test_storpool.py
cinder/tests/test_v6000_fcp.py
cinder/tests/test_volume.py
cinder/tests/test_volume_types.py

index 314513c46f665cef8e2f8227606a4a198ddd3153..7aee1daf77d5cc3c6ecb20c27ba06c60efec9cc2 100644 (file)
@@ -985,10 +985,10 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
     def test_disconnect_volume(self):
         """Test the basic disconnect volume case."""
         self.connector.connect_volume(self.connection_properties)
-        self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+        self.assertTrue(HuaweiStorHyperConnectorTestCase.attached)
         self.connector.disconnect_volume(self.connection_properties,
                                          self.device_info)
-        self.assertEqual(False, HuaweiStorHyperConnectorTestCase.attached)
+        self.assertFalse(HuaweiStorHyperConnectorTestCase.attached)
 
         expected_commands = [self.fake_sdscli_file + ' -c attach'
                              ' -v volume-b2911673-863c-4380-a5f2-e1729eecfe3f',
@@ -1005,14 +1005,14 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
     def test_is_volume_connected(self):
         """Test if volume connected to host case."""
         self.connector.connect_volume(self.connection_properties)
-        self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+        self.assertTrue(HuaweiStorHyperConnectorTestCase.attached)
         is_connected = self.connector.is_volume_connected(
             'volume-b2911673-863c-4380-a5f2-e1729eecfe3f')
         self.assertEqual(HuaweiStorHyperConnectorTestCase.attached,
                          is_connected)
         self.connector.disconnect_volume(self.connection_properties,
                                          self.device_info)
-        self.assertEqual(False, HuaweiStorHyperConnectorTestCase.attached)
+        self.assertFalse(HuaweiStorHyperConnectorTestCase.attached)
         is_connected = self.connector.is_volume_connected(
             'volume-b2911673-863c-4380-a5f2-e1729eecfe3f')
         self.assertEqual(HuaweiStorHyperConnectorTestCase.attached,
@@ -1056,7 +1056,7 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
     def test_disconnect_volume_fail(self):
         """Test the fail disconnect volume case."""
         self.connector.connect_volume(self.connection_properties)
-        self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+        self.assertTrue(HuaweiStorHyperConnectorTestCase.attached)
         self.assertRaises(exception.BrickException,
                           self.connector_fail.disconnect_volume,
                           self.connection_properties,
@@ -1083,7 +1083,7 @@ class HuaweiStorHyperConnectorTestCase(ConnectorTestCase):
     def test_disconnect_volume_nocli(self):
         """Test the fail disconnect volume case."""
         self.connector.connect_volume(self.connection_properties)
-        self.assertEqual(True, HuaweiStorHyperConnectorTestCase.attached)
+        self.assertTrue(HuaweiStorHyperConnectorTestCase.attached)
         self.assertRaises(exception.BrickException,
                           self.connector_nocli.disconnect_volume,
                           self.connection_properties,
index 68b91dc916d09c497687e771e94a957a934bcd1b..f4f9ee150e2f65575c86da6408fa251d78ae102f 100644 (file)
@@ -634,7 +634,7 @@ class TestGlanceImageServiceClient(test.TestCase):
             def __init__(inst, version, *args, **kwargs):
                 self.assertEqual('1', version)
                 self.assertEqual("http://fake_host:9292", args[0])
-                self.assertEqual(True, kwargs['token'])
+                self.assertTrue(kwargs['token'])
                 self.assertEqual(60, kwargs['timeout'])
 
         self.stubs.Set(glance.glanceclient, 'Client', MyGlanceStubClient)
@@ -666,7 +666,7 @@ class TestGlanceImageServiceClient(test.TestCase):
             def __init__(inst, version, *args, **kwargs):
                 self.assertEqual("1", version)
                 self.assertEqual("http://fake_host:9292", args[0])
-                self.assertEqual(True, kwargs['token'])
+                self.assertTrue(kwargs['token'])
                 self.assertNotIn('timeout', kwargs)
 
         self.stubs.Set(glance.glanceclient, 'Client', MyGlanceStubClient)
index e326fe1d04274d5a89f7d981f582135ea23edead..c167f057363b1d4d52805ca7b0c90f2ab97c062b 100644 (file)
@@ -1663,7 +1663,7 @@ class DellSCSanAPITestCase(test.TestCase):
         mock_delete.assert_called()
         mock_find_volume.assert_called_once_with(12345, self.volume_name, None)
         mock_get_json.assert_called()
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.HttpClient,
                        'delete',
@@ -1691,7 +1691,7 @@ class DellSCSanAPITestCase(test.TestCase):
         # Test case where volume to be deleted does not exist
         res = self.scapi.delete_volume(12345,
                                        self.volume_name)
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
                        '_create_folder_path',
@@ -1739,7 +1739,7 @@ class DellSCSanAPITestCase(test.TestCase):
                                   self.IQN,
                                   False)
         mock_post.assert_called()
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.HttpClient,
                        'post',
@@ -1753,7 +1753,7 @@ class DellSCSanAPITestCase(test.TestCase):
                                   self.WWN,
                                   True)
         mock_post.assert_called()
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.HttpClient,
                        'post',
@@ -1767,7 +1767,7 @@ class DellSCSanAPITestCase(test.TestCase):
                                   self.IQN,
                                   False)
         mock_post.assert_called()
-        self.assertEqual(False, res, 'Expected False')
+        self.assertFalse(res, 'Expected False')
 
     @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
                        '_get_json',
@@ -2736,7 +2736,7 @@ class DellSCSanAPITestCase(test.TestCase):
         mock_get.assert_called()
         mock_get_json.assert_called()
         mock_delete.assert_called()
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.HttpClient,
                        'get',
@@ -2749,7 +2749,7 @@ class DellSCSanAPITestCase(test.TestCase):
         res = self.scapi.unmap_volume(self.VOLUME,
                                       self.SCSERVER)
         mock_get.assert_called()
-        self.assertEqual(False, res, 'Expected False')
+        self.assertFalse(res, 'Expected False')
 
     @mock.patch.object(dell_storagecenter_api.HttpClient,
                        'delete',
@@ -2772,7 +2772,7 @@ class DellSCSanAPITestCase(test.TestCase):
         mock_get.assert_called()
         mock_get_json.assert_called()
         mock_delete.assert_called()
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.HttpClient,
                        'delete',
@@ -2795,7 +2795,7 @@ class DellSCSanAPITestCase(test.TestCase):
         mock_get.assert_called()
         mock_get_json.assert_called()
         mock_delete.assert_called()
-        self.assertEqual(False, res, 'Expected False')
+        self.assertFalse(res, 'Expected False')
 
     @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
                        '_get_json',
@@ -2999,7 +2999,7 @@ class DellSCSanAPITestCase(test.TestCase):
                                        replayId)
         mock_post.assert_called()
         mock_find_replay.assert_called_once_with(self.VOLUME, replayId)
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
                        'find_replay',
@@ -3019,7 +3019,7 @@ class DellSCSanAPITestCase(test.TestCase):
                                        replayId)
         mock_post.assert_called()
         mock_find_replay.assert_called_once_with(self.VOLUME, replayId)
-        self.assertEqual(True, res, 'Expected True')
+        self.assertTrue(res, 'Expected True')
 
     @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
                        'find_replay',
@@ -3039,7 +3039,7 @@ class DellSCSanAPITestCase(test.TestCase):
                                        replayId)
         mock_post.assert_called()
         mock_find_replay.assert_called_once_with(self.VOLUME, replayId)
-        self.assertEqual(False, res, 'Expected False')
+        self.assertFalse(res, 'Expected False')
 
     @mock.patch.object(dell_storagecenter_api.StorageCenterApi,
                        '_first_result',
index 8bd8ae62d82e967309b137d5b0bd764d3a173533..4ff3384ee4d594cef9da77f7e1a8d7278351830a 100644 (file)
@@ -66,35 +66,31 @@ class EvaluatorTestCase(test.TestCase):
             -8.0, evaluator. evaluate("((1.0 / 0.5) * (2)) *(-2)"))
 
     def test_comparisons(self):
-        self.assertEqual(True, evaluator.evaluate("1 < 2"))
-        self.assertEqual(True, evaluator.evaluate("2 > 1"))
-        self.assertEqual(True, evaluator.evaluate("2 != 1"))
-        self.assertEqual(False, evaluator.evaluate("1 > 2"))
-        self.assertEqual(False, evaluator.evaluate("2 < 1"))
-        self.assertEqual(False, evaluator.evaluate("2 == 1"))
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) == !(1 == 2)"))
+        self.assertTrue(evaluator.evaluate("1 < 2"))
+        self.assertTrue(evaluator.evaluate("2 > 1"))
+        self.assertTrue(evaluator.evaluate("2 != 1"))
+        self.assertFalse(evaluator.evaluate("1 > 2"))
+        self.assertFalse(evaluator.evaluate("2 < 1"))
+        self.assertFalse(evaluator.evaluate("2 == 1"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) == !(1 == 2)"))
 
     def test_logic_ops(self):
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) AND (2 == 2)"))
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) and (2 == 2)"))
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) && (2 == 2)"))
-        self.assertEqual(False, evaluator.evaluate("(1 == 1) && (5 == 2)"))
-
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) OR (5 == 2)"))
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) or (5 == 2)"))
-        self.assertEqual(True, evaluator.evaluate("(1 == 1) || (5 == 2)"))
-        self.assertEqual(False, evaluator.evaluate("(5 == 1) || (5 == 2)"))
-
-        self.assertEqual(
-            False, evaluator.evaluate("(1 == 1) AND NOT (2 == 2)"))
-        self.assertEqual(
-            False, evaluator.evaluate("(1 == 1) AND not (2 == 2)"))
-        self.assertEqual(
-            False, evaluator.evaluate("(1 == 1) AND !(2 == 2)"))
-        self.assertEqual(
-            True, evaluator.evaluate("(1 == 1) AND NOT (5 == 2)"))
-        self.assertEqual(
-            True, evaluator.evaluate("(1 == 1) OR NOT (2 == 2) AND (5 == 5)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) AND (2 == 2)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) and (2 == 2)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) && (2 == 2)"))
+        self.assertFalse(evaluator.evaluate("(1 == 1) && (5 == 2)"))
+
+        self.assertTrue(evaluator.evaluate("(1 == 1) OR (5 == 2)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) or (5 == 2)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) || (5 == 2)"))
+        self.assertFalse(evaluator.evaluate("(5 == 1) || (5 == 2)"))
+
+        self.assertFalse(evaluator.evaluate("(1 == 1) AND NOT (2 == 2)"))
+        self.assertFalse(evaluator.evaluate("(1 == 1) AND not (2 == 2)"))
+        self.assertFalse(evaluator.evaluate("(1 == 1) AND !(2 == 2)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) AND NOT (5 == 2)"))
+        self.assertTrue(evaluator.evaluate("(1 == 1) OR NOT (2 == 2) "
+                                           "AND (5 == 5)"))
 
     def test_ternary_conditional(self):
         self.assertEqual(5, evaluator.evaluate("(1 < 2) ? 5 : 10"))
index 0f9db292f219fbcf2a1688924bceffb8122fdbbb..b85da12501bf3cf53ed59882771e7dbd5d31c3ee 100644 (file)
@@ -763,8 +763,7 @@ class GlusterFsDriverTestCase(test.TestCase):
             cmd = ['umount', test_hashpath]
             self.assertEqual(cmd[0], mock_execute.call_args[0][0])
             self.assertEqual(cmd[1], mock_execute.call_args[0][1])
-            self.assertEqual(True,
-                             mock_execute.call_args[1]['run_as_root'])
+            self.assertTrue(mock_execute.call_args[1]['run_as_root'])
 
             mock_get_mntp_share.reset_mock()
             mock_get_mntp_share.return_value = test_hashpath
@@ -778,8 +777,7 @@ class GlusterFsDriverTestCase(test.TestCase):
             cmd = ['umount', test_hashpath]
             self.assertEqual(cmd[0], mock_execute.call_args[0][0])
             self.assertEqual(cmd[1], mock_execute.call_args[0][1])
-            self.assertEqual(True,
-                             mock_execute.call_args[1]['run_as_root'])
+            self.assertTrue(mock_execute.call_args[1]['run_as_root'])
 
     def test_do_umount_with_excp1(self):
         test_share = '127.7.7.7:/gluster1'
index 6780bc5b065cc1df7c6215b41a0529373475a2b5..f2c8aebf39f380c497cdbd4cbac6e546eb43e12f 100644 (file)
@@ -102,8 +102,8 @@ class GPFSDriverTestCase(test.TestCase):
                                   'nodesUp:totalNodes:remarks:cnfsState:\n'
                                   'mmgetstate::0:1:::devstack:3:active:2:3:3:'
                                   'quorum node:(undefined):', '')
-        self.assertEqual(True, self.driver._get_gpfs_state().splitlines()[1].
-                         startswith('mmgetstate::0:1:::devstack'))
+        self.assertTrue(self.driver._get_gpfs_state().splitlines()[1].
+                        startswith('mmgetstate::0:1:::devstack'))
 
     @mock.patch('cinder.utils.execute')
     def test_get_gpfs_state_fail_mmgetstate(self, mock_exec):
@@ -780,8 +780,8 @@ class GPFSDriverTestCase(test.TestCase):
         org_value = self.driver.configuration.gpfs_sparse_volumes
         self.flags(volume_driver=self.driver_name, gpfs_sparse_volumes=False)
         self.driver.create_volume(volume)
-        self.assertEqual(True, self.driver._set_volume_attributes(volume,
-                         'test', metadata))
+        self.assertTrue(self.driver._set_volume_attributes(volume, 'test',
+                                                           metadata))
         self.flags(volume_driver=self.driver_name,
                    gpfs_sparse_volumes=org_value)
 
@@ -846,8 +846,8 @@ class GPFSDriverTestCase(test.TestCase):
         mock_set_volume_attributes.return_value = True
         metadata = [{'key': 'fake_key', 'value': 'fake_value'}]
 
-        self.assertEqual(True, self.driver._set_volume_attributes(volume,
-                         'test', metadata))
+        self.assertTrue(self.driver._set_volume_attributes(volume, 'test',
+                                                           metadata))
         self.assertEqual(self.driver.create_volume_from_snapshot(volume,
                                                                  snapshot),
                          {'size': 5.0})
@@ -898,8 +898,8 @@ class GPFSDriverTestCase(test.TestCase):
         mock_set_volume_attributes.return_value = True
         metadata = [{'key': 'fake_key', 'value': 'fake_value'}]
 
-        self.assertEqual(True, self.driver._set_volume_attributes(volume,
-                         'test', metadata))
+        self.assertTrue(self.driver._set_volume_attributes(volume, 'test',
+                                                           metadata))
         self.assertEqual(self.driver.create_cloned_volume(volume, src_volume),
                          {'size': 5.0})
 
@@ -968,14 +968,14 @@ class GPFSDriverTestCase(test.TestCase):
                                   '    no      2          148488  '
                                   '/gpfs0/test.txt', ''),
                                  ('', '')]
-        self.assertEqual(True, self.driver._gpfs_redirect(''))
+        self.assertTrue(self.driver._gpfs_redirect(''))
         self.flags(volume_driver=self.driver_name, gpfs_max_clone_depth=1)
         mock_exec.side_effect = [('Parent  Depth   Parent inode   File name\n'
                                   '------  -----  --------------  ---------\n'
                                   '    no      1          148488  '
                                   '/gpfs0/test.txt', ''),
                                  ('', '')]
-        self.assertEqual(False, self.driver._gpfs_redirect(''))
+        self.assertFalse(self.driver._gpfs_redirect(''))
         self.flags(volume_driver=self.driver_name,
                    gpfs_max_clone_depth=org_value)
 
@@ -988,7 +988,7 @@ class GPFSDriverTestCase(test.TestCase):
                                   '    no      2          148488  '
                                   '/gpfs0/test.txt', ''),
                                  ('', '')]
-        self.assertEqual(False, self.driver._gpfs_redirect(''))
+        self.assertFalse(self.driver._gpfs_redirect(''))
         self.flags(volume_driver=self.driver_name,
                    gpfs_max_clone_depth=org_value)
 
@@ -1001,7 +1001,7 @@ class GPFSDriverTestCase(test.TestCase):
                                   '                       148488  '
                                   '/gpfs0/test.txt', ''),
                                  ('', '')]
-        self.assertEqual(False, self.driver._gpfs_redirect(''))
+        self.assertFalse(self.driver._gpfs_redirect(''))
         self.flags(volume_driver=self.driver_name,
                    gpfs_max_clone_depth=org_value)
 
@@ -1038,8 +1038,8 @@ class GPFSDriverTestCase(test.TestCase):
                                   '------  -----  --------------  ---------\n'
                                   '    no      2          148488  '
                                   '/gpfs0/test.txt', '')]
-        self.assertEqual(True, self.driver._is_gpfs_parent_file(''))
-        self.assertEqual(False, self.driver._is_gpfs_parent_file(''))
+        self.assertTrue(self.driver._is_gpfs_parent_file(''))
+        self.assertFalse(self.driver._is_gpfs_parent_file(''))
 
     @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver._gpfs_redirect')
     @mock.patch('cinder.volume.drivers.ibm.gpfs.GPFSDriver.'
index 2a7f9684efb2bfc0901b0e6f794c5607fe4e4686..9e3e2608c687c2e08a5a70200baccfb03ab108a1 100644 (file)
@@ -886,7 +886,7 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase):
 
             # validate
             self.assertEqual('iscsi', result['driver_volume_type'])
-            self.assertEqual(False, result['data']['target_discovered'])
+            self.assertFalse(result['data']['target_discovered'])
             self.assertEqual(self.volume_id, result['data']['volume_id'])
             self.assertTrue('auth_method' not in result['data'])
 
@@ -939,7 +939,7 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase):
 
             # validate
             self.assertEqual('iscsi', result['driver_volume_type'])
-            self.assertEqual(False, result['data']['target_discovered'])
+            self.assertFalse(result['data']['target_discovered'])
             self.assertEqual(self.volume_id, result['data']['volume_id'])
             self.assertTrue('auth_method' not in result['data'])
 
@@ -986,7 +986,7 @@ class TestHPLeftHandRESTISCSIDriver(HPLeftHandBaseDriver, test.TestCase):
 
             # validate
             self.assertEqual('iscsi', result['driver_volume_type'])
-            self.assertEqual(False, result['data']['target_discovered'])
+            self.assertFalse(result['data']['target_discovered'])
             self.assertEqual(self.volume_id, result['data']['volume_id'])
             self.assertEqual('CHAP', result['data']['auth_method'])
 
index 70791cb1a643dec1f3d76b9612b93a8022b53d03..7c3263ad4b252a02aad4b01178e6bbb2d2f16cd4 100644 (file)
@@ -1053,8 +1053,8 @@ class FlashSystemDriverTestCase(test.TestCase):
             vol1['name'], vol1['id'], vol2['name'], vol2['id'])
         (v1_mapped, lun) = self.driver._is_vdisk_map(vol1['name'], connector)
         (v2_mapped, lun) = self.driver._is_vdisk_map(vol2['name'], connector)
-        self.assertEqual(False, v1_mapped)
-        self.assertEqual(False, v2_mapped)
+        self.assertFalse(v1_mapped)
+        self.assertFalse(v2_mapped)
 
         # case 2: mapped before copy
         self.driver.initialize_connection(vol1, connector)
@@ -1063,8 +1063,8 @@ class FlashSystemDriverTestCase(test.TestCase):
             vol1['name'], vol1['id'], vol2['name'], vol2['id'])
         (v1_mapped, lun) = self.driver._is_vdisk_map(vol1['name'], connector)
         (v2_mapped, lun) = self.driver._is_vdisk_map(vol2['name'], connector)
-        self.assertEqual(True, v1_mapped)
-        self.assertEqual(True, v2_mapped)
+        self.assertTrue(v1_mapped)
+        self.assertTrue(v2_mapped)
         self.driver.terminate_connection(vol1, connector)
         self.driver.terminate_connection(vol2, connector)
 
@@ -1076,8 +1076,8 @@ class FlashSystemDriverTestCase(test.TestCase):
             vol1['name'], vol1['id'], vol2['name'], vol2['id'])
         (v1_mapped, lun) = self.driver._is_vdisk_map(vol1['name'], connector)
         (v2_mapped, lun) = self.driver._is_vdisk_map(vol2['name'], connector)
-        self.assertEqual(False, v1_mapped)
-        self.assertEqual(False, v2_mapped)
+        self.assertFalse(v1_mapped)
+        self.assertFalse(v2_mapped)
 
         # case 4: no mapped before copy, raise exception when copy
         copy_volume.side_effect = exception.VolumeBackendAPIException
@@ -1087,8 +1087,8 @@ class FlashSystemDriverTestCase(test.TestCase):
             vol1['name'], vol1['id'], vol2['name'], vol2['id'])
         (v1_mapped, lun) = self.driver._is_vdisk_map(vol1['name'], connector)
         (v2_mapped, lun) = self.driver._is_vdisk_map(vol2['name'], connector)
-        self.assertEqual(False, v1_mapped)
-        self.assertEqual(False, v2_mapped)
+        self.assertFalse(v1_mapped)
+        self.assertFalse(v2_mapped)
 
         # clear environment
         self.driver.delete_volume(vol1)
index 114dd857d843aff68c346bfb595859d40b9d9a14..01e8efeb04844a5ebcb6d91f41c61f04eb5daa7e 100644 (file)
@@ -268,8 +268,8 @@ class IBMNASDriverTestCase(test.TestCase):
         drv = self._driver
         mock_size.return_value = True
 
-        self.assertEqual(True, drv._resize_volume_file(self.TEST_LOCAL_PATH,
-                         self.TEST_EXTEND_SIZE_IN_GB))
+        self.assertTrue(drv._resize_volume_file(self.TEST_LOCAL_PATH,
+                                                self.TEST_EXTEND_SIZE_IN_GB))
 
     @mock.patch('cinder.image.image_utils.resize_image')
     def test_resize_volume_exception(self, mock_size):
index 5ea48ed5ffec69d7e46240d54820bcf7a4c02c97..e98336ea14640d06e38ffa1cfd3344ed95ca456d 100644 (file)
@@ -460,7 +460,7 @@ class TestProphetStorDPLDriver(test.TestCase):
         self.assertEqual(4, pool['total_capacity_gb'])
         self.assertEqual(4, pool['free_capacity_gb'])
         self.assertEqual(0, pool['reserved_percentage'])
-        self.assertEqual(False, pool['QoS_support'])
+        self.assertFalse(pool['QoS_support'])
 
     def test_create_volume(self):
         self.DPL_MOCK.create_vdev.return_value = DATA_OUTPUT
@@ -576,7 +576,7 @@ class TestProphetStorDPLDriver(test.TestCase):
                                                    DATA_IN_CONNECTOR)
         self.assertEqual('iscsi', res['driver_volume_type'])
         self.assertEqual('101', res['data']['target_lun'])
-        self.assertEqual(True, res['data']['target_discovered'])
+        self.assertTrue(res['data']['target_discovered'])
         self.assertEqual('172.31.1.210:3260', res['data']['target_portal'])
         self.assertEqual(
             'iqn.2013-09.com.prophetstor:hypervisor.886423051816',
index 75fb43188f0aee551ab599a1619da5ffba6b460a..aa1dd69fe95cc02fddf2624bd66b0adbebf9845a 100644 (file)
@@ -239,28 +239,28 @@ class SmbFsTestCase(test.TestCase):
         fake_volume_size = 2
         ret_value = self._test_is_share_eligible(fake_capacity_info,
                                                  fake_volume_size)
-        self.assertEqual(ret_value, False)
+        self.assertFalse(ret_value)
 
     def test_eligible_share(self):
         fake_capacity_info = (4, 4, 0)
         fake_volume_size = 1
         ret_value = self._test_is_share_eligible(fake_capacity_info,
                                                  fake_volume_size)
-        self.assertEqual(ret_value, True)
+        self.assertTrue(ret_value)
 
     def test_share_volume_above_oversub_ratio(self):
         fake_capacity_info = (4, 4, 7)
         fake_volume_size = 2
         ret_value = self._test_is_share_eligible(fake_capacity_info,
                                                  fake_volume_size)
-        self.assertEqual(ret_value, False)
+        self.assertFalse(ret_value)
 
     def test_share_reserved_above_oversub_ratio(self):
         fake_capacity_info = (4, 4, 10)
         fake_volume_size = 1
         ret_value = self._test_is_share_eligible(fake_capacity_info,
                                                  fake_volume_size)
-        self.assertEqual(ret_value, False)
+        self.assertFalse(ret_value)
 
     def test_parse_options(self):
         (opt_list,
index 36a0598232ddbb2b78fd2c4cdfe6af525ccd5a25..5f6054ce2350c143284d9d3427cd29c485b87f12 100644 (file)
@@ -214,7 +214,7 @@ class StorPoolTestCase(test.TestCase):
                                        'volume_type': None})
         except exception.VolumeBackendAPIException:
             caught = True
-        self.assertEqual(True, caught)
+        self.assertTrue(caught)
 
         self.driver.delete_volume({'id': '1'})
         self.assertVolumeNames([])
index a28ac7ae010bd2b37f729848b88a9932477da970..c796446cb37e56074821f6546b36cce36bdffa85 100644 (file)
@@ -224,7 +224,7 @@ class V6000FCPDriverTestCase(test.TestCase):
         self.driver._build_initiator_target_map.assert_called_with(
             CONNECTOR)
         self.assertEqual("fibre_channel", props['driver_volume_type'])
-        self.assertEqual(True, props['data']['target_discovered'])
+        self.assertTrue(props['data']['target_discovered'])
         self.assertEqual(target_wwns, props['data']['target_wwn'])
         self.assertEqual(lun_id, props['data']['target_lun'])
         self.assertEqual(init_targ_map, props['data']['initiator_target_map'])
@@ -249,7 +249,7 @@ class V6000FCPDriverTestCase(test.TestCase):
         self.driver._build_initiator_target_map.assert_called_with(
             CONNECTOR)
         self.assertEqual("fibre_channel", props['driver_volume_type'])
-        self.assertEqual(True, props['data']['target_discovered'])
+        self.assertTrue(props['data']['target_discovered'])
         self.assertEqual(target_wwns, props['data']['target_wwn'])
         self.assertEqual(lun_id, props['data']['target_lun'])
         self.assertEqual(init_targ_map, props['data']['initiator_target_map'])
index 3b9eeb245cc3dda7913e93903b28faa2e4afd4af..3837900187ac4a1d9f7c83ea38855188a0c41193 100644 (file)
@@ -721,7 +721,7 @@ class VolumeTestCase(BaseVolumeTestCase):
                                       volume_name='fake'))
         self.mox.ReplayAll()
         res = self.volume.delete_volume(self.context, volume_id)
-        self.assertEqual(True, res)
+        self.assertTrue(res)
         volume_ref = db.volume_get(context.get_admin_context(), volume_id)
         self.assertEqual(volume_id, volume_ref.id)
         self.assertEqual("available", volume_ref.status)
@@ -4442,7 +4442,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
         vol = {'name': 'test', 'id': 1, 'size': 1, 'status': 'available'}
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, False)
+        self.assertFalse(moved)
         self.assertIsNone(model_update)
 
     def test_lvm_migrate_volume_bad_loc_info(self):
@@ -4451,7 +4451,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
         vol = {'name': 'test', 'id': 1, 'size': 1, 'status': 'available'}
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, False)
+        self.assertFalse(moved)
         self.assertIsNone(model_update)
 
     def test_lvm_migrate_volume_diff_driver(self):
@@ -4460,7 +4460,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
         vol = {'name': 'test', 'id': 1, 'size': 1, 'status': 'available'}
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, False)
+        self.assertFalse(moved)
         self.assertIsNone(model_update)
 
     def test_lvm_migrate_volume_diff_host(self):
@@ -4469,7 +4469,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
         vol = {'name': 'test', 'id': 1, 'size': 1, 'status': 'available'}
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, False)
+        self.assertFalse(moved)
         self.assertIsNone(model_update)
 
     def test_lvm_migrate_volume_in_use(self):
@@ -4479,7 +4479,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
         vol = {'name': 'test', 'id': 1, 'size': 1, 'status': 'in-use'}
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, False)
+        self.assertFalse(moved)
         self.assertIsNone(model_update)
 
     @mock.patch.object(volutils, 'get_all_volume_groups',
@@ -4519,7 +4519,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
 
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, False)
+        self.assertFalse(moved)
         self.assertIsNone(model_update)
 
     def test_lvm_migrate_volume_proceed(self):
@@ -4565,7 +4565,7 @@ class LVMISCSIVolumeDriverTestCase(DriverTestCase):
                                                       'default')
         moved, model_update = self.volume.driver.migrate_volume(self.context,
                                                                 vol, host)
-        self.assertEqual(moved, True)
+        self.assertTrue(moved)
         self.assertIsNone(model_update)
 
     @staticmethod
index b6abc15a83a40d537e93d321a79d4f9f5256f23a..e81ab8fd1071f253edf853b64b28619a6561fb28 100644 (file)
@@ -293,11 +293,11 @@ class VolumeTypeTestCase(test.TestCase):
         # Check equality with only extra_specs
         diff, same = volume_types.volume_types_diff(self.ctxt, type_ref1['id'],
                                                     type_ref2['id'])
-        self.assertEqual(same, True)
+        self.assertTrue(same)
         self.assertEqual(diff['extra_specs']['key1'], ('val1', 'val1'))
         diff, same = volume_types.volume_types_diff(self.ctxt, type_ref1['id'],
                                                     type_ref3['id'])
-        self.assertEqual(same, False)
+        self.assertFalse(same)
         self.assertEqual(diff['extra_specs']['key1'], ('val1', 'val0'))
 
         # qos_ref 1 and 2 have the same specs, while 3 has different
@@ -314,7 +314,7 @@ class VolumeTypeTestCase(test.TestCase):
                                           type_ref2['id'])
         diff, same = volume_types.volume_types_diff(self.ctxt, type_ref1['id'],
                                                     type_ref2['id'])
-        self.assertEqual(same, True)
+        self.assertTrue(same)
         self.assertEqual(diff['extra_specs']['key1'], ('val1', 'val1'))
         self.assertEqual(diff['qos_specs']['k1'], ('v1', 'v1'))
         qos_specs.disassociate_qos_specs(self.ctxt, qos_ref2['id'],
@@ -323,7 +323,7 @@ class VolumeTypeTestCase(test.TestCase):
                                           type_ref2['id'])
         diff, same = volume_types.volume_types_diff(self.ctxt, type_ref1['id'],
                                                     type_ref2['id'])
-        self.assertEqual(same, False)
+        self.assertFalse(same)
         self.assertEqual(diff['extra_specs']['key1'], ('val1', 'val1'))
         self.assertEqual(diff['qos_specs']['k1'], ('v1', 'v0'))
         qos_specs.disassociate_qos_specs(self.ctxt, qos_ref3['id'],
@@ -344,7 +344,7 @@ class VolumeTypeTestCase(test.TestCase):
                                          enc_keyvals2)
         diff, same = volume_types.volume_types_diff(self.ctxt, type_ref1['id'],
                                                     type_ref2['id'])
-        self.assertEqual(same, False)
+        self.assertFalse(same)
         self.assertEqual(diff['extra_specs']['key1'], ('val1', 'val1'))
         self.assertEqual(diff['qos_specs']['k1'], ('v1', 'v1'))
         self.assertEqual(diff['encryption']['key_size'], (256, 128))
@@ -352,7 +352,7 @@ class VolumeTypeTestCase(test.TestCase):
         # Check diff equals type specs when one type is None
         diff, same = volume_types.volume_types_diff(self.ctxt, None,
                                                     type_ref1['id'])
-        self.assertEqual(same, False)
+        self.assertFalse(same)
         self.assertEqual(diff['extra_specs'],
                          {'key1': (None, 'val1'), 'key2': (None, 'val2')})
         self.assertEqual(diff['qos_specs'],