]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Replace assertEqual(None, *) with assertIsNone in tests
authorAlexander Bochkarev <abochkarev@mirantis.com>
Tue, 25 Feb 2014 11:32:11 +0000 (15:32 +0400)
committerAlexander Bochkarev <abochkarev@mirantis.com>
Tue, 25 Feb 2014 11:32:11 +0000 (15:32 +0400)
Replace assertEqual(None, *) with assertIsNone in tests to have
more clear messages in case of failure.

Change-Id: I2560aa559580fb068eb27174c9a7c8cd57e11b69

cinder/tests/test_hp_msa.py
cinder/tests/test_ibmnas.py

index 662ebcbd4058679c5c96f60f1d0dbc4b7063c26d..0418b6f32be5f4ddf3d0c8adb4d90283577f8378 100644 (file)
@@ -272,8 +272,7 @@ class TestHPMSACommon(test.TestCase):
     def test_assert_connector_ok(self):
         self.assertRaises(exception.InvalidInput,
                           self.common._assert_connector_ok, invalid_connector)
-        self.assertEqual(None,
-                         self.common._assert_connector_ok(connector))
+        self.assertIsNone(self.common._assert_connector_ok(connector))
 
     @mock.patch.object(msa.HPMSAClient, 'vdisk_stats')
     def test_update_volume_stats(self, mock_stats):
index d8e715939e9ca786956d7f4bd532b19da1f7c81d..8105eb61ab43ef957f23fd9dc085086371fed396 100644 (file)
@@ -162,11 +162,11 @@ class IBMNASDriverTestCase(test.TestCase):
         drv._create_ibmnas_snap = mock.drv._run_ssh.return_value.\
             drv._execute.return_value.drv._create_ibmnas_snap
         drv._create_ibmnas_snap.return_value = None
-        self.assertEqual(None, mock.drv._run_ssh().
-                         drv._execute().
-                         drv._create_ibmnas_snap(self.TEST_VOLUME_PATH,
-                                                 self.TEST_SNAP_PATH,
-                                                 None))
+        self.assertIsNone(mock.drv._run_ssh().
+                          drv._execute().
+                          drv._create_ibmnas_snap(self.TEST_VOLUME_PATH,
+                                                  self.TEST_SNAP_PATH,
+                                                  None))
 
     def test_create_ibmnas_copy(self):
         """Create ibmnas copy test case."""
@@ -180,11 +180,11 @@ class IBMNASDriverTestCase(test.TestCase):
         drv._create_ibmnas_copy = mock.drv._run_ssh.return_value.\
             drv._create_ibmnas_copy
         drv._create_ibmnas_copy.return_value = None
-        self.assertEqual(None, mock.drv._run_ssh().
-                         drv._create_ibmnas_copy(
-                             self.TEST_VOLUME_PATH,
-                             TEST_DEST_PATH,
-                             TEST_DEST_SNAP))
+        self.assertIsNone(mock.drv._run_ssh().
+                          drv._create_ibmnas_copy(
+                              self.TEST_VOLUME_PATH,
+                              TEST_DEST_PATH,
+                              TEST_DEST_SNAP))
 
     def test_resize_volume_file(self):
         """Resize volume file test case."""
@@ -210,11 +210,11 @@ class IBMNASDriverTestCase(test.TestCase):
             drv._resize_volume_file.return_value.\
             drv.extend_volume
         drv.extend_volume.return_value = None
-        self.assertEqual(None, mock.drv.local_path().
-                         drv._resize_volume_file().
-                         drv.extend_volume(
-                             self.TEST_LOCAL_PATH,
-                             self.TEST_EXTEND_SIZE_IN_GB))
+        self.assertIsNone(mock.drv.local_path().
+                          drv._resize_volume_file().
+                          drv.extend_volume(
+                              self.TEST_LOCAL_PATH,
+                              self.TEST_EXTEND_SIZE_IN_GB))
 
     def test_delete_snapfiles(self):
         """Delete_snapfiles assert test case."""
@@ -226,11 +226,11 @@ class IBMNASDriverTestCase(test.TestCase):
             drv._execute.return_value.\
             drv._delete_snapfiles
         drv._delete_snapfiles.return_value = None
-        self.assertEqual(None, mock.drv._run_ssh().
-                         drv._execute().
-                         drv._delete_snapfiles(
-                             self.TEST_VOLUME_PATH,
-                             self.TEST_MNT_POINT))
+        self.assertIsNone(mock.drv._run_ssh().
+                          drv._execute().
+                          drv._delete_snapfiles(
+                              self.TEST_VOLUME_PATH,
+                              self.TEST_MNT_POINT))
 
     def test_delete_volume_no_provider_location(self):
         """Delete volume with no provider location specified."""
@@ -242,7 +242,7 @@ class IBMNASDriverTestCase(test.TestCase):
         volume['provider_location'] = None
 
         result = drv.delete_volume(volume)
-        self.assertEqual(None, result)
+        self.assertIsNone(result)
 
     def test_delete_volume(self):
         """Delete volume test case."""
@@ -284,15 +284,14 @@ class IBMNASDriverTestCase(test.TestCase):
             drv._create_ibmnas_snap.return_value.\
             drv.create_snapshot
         drv.create_snapshot.return_value = None
-        self.assertEqual(None,
-                         mock.drv._get_export_path(snapshot['volume_id']).
-                         drv._get_provider_location(snapshot['volume_id']).
-                         drv._get_mount_point_for_share(self.TEST_NFS_EXPORT).
-                         drv._create_ibmnas_snap(
-                             src=self.TEST_VOLUME_PATH,
-                             dest=self.TEST_SNAP_PATH,
-                             mount_path=self.TEST_MNT_POINT).
-                         drv.create_snapshot(snapshot))
+        self.assertIsNone(mock.drv._get_export_path(snapshot['volume_id']).
+                          drv._get_provider_location(snapshot['volume_id']).
+                          drv._get_mount_point_for_share(self.TEST_NFS_EXPORT).
+                          drv._create_ibmnas_snap(
+                              src=self.TEST_VOLUME_PATH,
+                              dest=self.TEST_SNAP_PATH,
+                              mount_path=self.TEST_MNT_POINT).
+                          drv.create_snapshot(snapshot))
 
     def test_delete_snapshot(self):
         """Delete snapshot simple test case."""
@@ -313,10 +312,10 @@ class IBMNASDriverTestCase(test.TestCase):
             drv._get_mount_point_for_share.return_value.drv._execute.\
             return_value.drv.delete_snapshot
         drv.delete_snapshot.return_value = None
-        self.assertEqual(None, mock.drv._get_provider_location(volume['id']).
-                         drv._get_mount_point_for_share(self.TEST_NFS_EXPORT).
-                         drv._execute().
-                         drv.delete_snapshot(snapshot))
+        self.assertIsNone(mock.drv._get_provider_location(volume['id']).
+                          drv._get_mount_point_for_share(self.TEST_NFS_EXPORT).
+                          drv._execute().
+                          drv.delete_snapshot(snapshot))
 
     def test_create_cloned_volume(self):
         """Clone volume with equal size test case."""