From 67f1f033b038d8ea2c829038f9d03600d85fcab8 Mon Sep 17 00:00:00 2001 From: "sharat.sharma" Date: Mon, 23 May 2016 18:36:51 +0530 Subject: [PATCH] Replace assertEqual(None, *) with assertIsNone in tests Replace assertEqual(None, *) with assertIsNone in tests to have more clear messages in case of failure. Change-Id: Ie57df9cefb961b0e55cd2483cd00b31eef296a0b Closes-Bug: #1584736 --- .../share/drivers/cephfs/test_cephfs_native.py | 2 +- .../drivers/glusterfs/test_layout_volume.py | 2 +- .../dataontap/cluster_mode/test_lib_base.py | 16 ++++++++-------- manila/tests/share/test_manager.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manila/tests/share/drivers/cephfs/test_cephfs_native.py b/manila/tests/share/drivers/cephfs/test_cephfs_native.py index d95dab3d27..9f635ee472 100644 --- a/manila/tests/share/drivers/cephfs/test_cephfs_native.py +++ b/manila/tests/share/drivers/cephfs/test_cephfs_native.py @@ -345,7 +345,7 @@ class CephFSNativeDriverTestCase(test.TestCase): vc.disconnect.assert_called_once_with() def test_delete_driver_no_client(self): - self.assertEqual(None, self._driver._volume_client) + self.assertIsNone(self._driver._volume_client) del self._driver def test_connect_noevict(self): diff --git a/manila/tests/share/drivers/glusterfs/test_layout_volume.py b/manila/tests/share/drivers/glusterfs/test_layout_volume.py index a0ee395f4e..3985c0bfb1 100644 --- a/manila/tests/share/drivers/glusterfs/test_layout_volume.py +++ b/manila/tests/share/drivers/glusterfs/test_layout_volume.py @@ -354,7 +354,7 @@ class GlusterfsVolumeMappedLayoutTestCase(test.TestCase): self._layout.private_storage.get.assert_called_once_with( self.share1['id'], 'volume') - self.assertEqual(None, ret) + self.assertIsNone(ret) def test_ensure_share(self): share = self.share1 diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py index 88e44cc712..7a18724daa 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py @@ -2159,7 +2159,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): fake.SHARE, [], share_server=None) - self.assertEqual(None, result) + self.assertIsNone(result) mock_dm_session.delete_snapmirror.assert_called_with(fake.SHARE, fake.SHARE) self.assertEqual(2, mock_dm_session.delete_snapmirror.call_count) @@ -2186,7 +2186,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): fake.SHARE, [], share_server=fake.SHARE_SERVER) - self.assertEqual(None, result) + self.assertIsNone(result) mock_dm_session.delete_snapmirror.assert_called_with(fake.SHARE, fake.SHARE) self.assertEqual(2, mock_dm_session.delete_snapmirror.call_count) @@ -2215,7 +2215,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): [], share_server=None) - self.assertEqual(None, result) + self.assertIsNone(result) self.assertFalse(self.library._deallocate_container.called) mock_dm_session.delete_snapmirror.assert_called_with(fake.SHARE, fake.SHARE) @@ -3200,7 +3200,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): model_update = self.library.update_replicated_snapshot( replica_list, self.fake_replica_2, [fake_snapshot], fake_snapshot) - self.assertEqual(None, model_update) + self.assertIsNone(model_update) self.mock_dm_session.update_snapmirror.assert_called_once_with( self.fake_replica, self.fake_replica_2 ) @@ -3224,7 +3224,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): model_update = self.library.update_replicated_snapshot( replica_list, self.fake_replica_2, [fake_snapshot], fake_snapshot) - self.assertEqual(None, model_update) + self.assertIsNone(model_update) self.mock_dm_session.update_snapmirror.assert_called_once_with( self.fake_replica, self.fake_replica_2 ) @@ -3250,7 +3250,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): model_update = self.library.update_replicated_snapshot( replica_list, self.fake_replica_2, [fake_snapshot], fake_snapshot) - self.assertEqual(None, model_update) + self.assertIsNone(model_update) self.mock_dm_session.update_snapmirror.assert_called_once_with( self.fake_replica, self.fake_replica_2 ) @@ -3298,7 +3298,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): model_update = self.library.update_replicated_snapshot( replica_list, self.fake_replica, [fake_snapshot], fake_snapshot) - self.assertEqual(None, model_update) + self.assertIsNone(model_update) def test_update_replicated_snapshot_created(self): vserver_client = mock.Mock() @@ -3382,4 +3382,4 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): model_update = self.library.update_replicated_snapshot( replica_list, self.fake_replica, [fake_snapshot], fake_snapshot) - self.assertEqual(None, model_update) + self.assertIsNone(model_update) diff --git a/manila/tests/share/test_manager.py b/manila/tests/share/test_manager.py index a2bd3b9f04..cb95b3e9ce 100644 --- a/manila/tests/share/test_manager.py +++ b/manila/tests/share/test_manager.py @@ -1448,7 +1448,7 @@ class ShareManagerTestCase(test.TestCase): return_value = self.share_manager.create_snapshot( self.context, share_id, snapshot_id) - self.assertEqual(None, return_value) + self.assertIsNone(return_value) self.share_manager.driver.create_snapshot.assert_called_once_with( self.context, expected_snapshot_instance_dict, share_server=None) db_update.assert_has_calls(expected_update_calls, any_order=True)