Replace assertTrue(isinstance()) with assertIsInstance()

Some of tests use different method of assertTrue(isinstance(A, B)) or
assertEqual(type(A), B). The correct way is to use assertIsInstance(A,
B) provided by testtools.

Change-Id: I1a5462443bf3cec4a14945df036e924a50fd74b3
This commit is contained in:
melissaml 2017-07-06 12:51:49 +08:00
parent 41ea204fc5
commit be67034aef

View File

@ -53,8 +53,8 @@ class HPESushyTestCase(testtools.TestCase):
@mock.patch.object(system, 'HPESystem', autospec=True) @mock.patch.object(system, 'HPESystem', autospec=True)
def test_get_system(self, mock_system): def test_get_system(self, mock_system):
sys_inst = self.hpe_sushy.get_system('1234') sys_inst = self.hpe_sushy.get_system('1234')
self.assertTrue(isinstance(sys_inst, self.assertIsInstance(sys_inst,
system.HPESystem.__class__)) system.HPESystem.__class__)
mock_system.assert_called_once_with(self.hpe_sushy._conn, mock_system.assert_called_once_with(self.hpe_sushy._conn,
'1234', '1234',
self.hpe_sushy.redfish_version) self.hpe_sushy.redfish_version)
@ -73,8 +73,8 @@ class HPESushyTestCase(testtools.TestCase):
@mock.patch.object(manager, 'HPEManager', autospec=True) @mock.patch.object(manager, 'HPEManager', autospec=True)
def test_get_manager(self, mock_manager): def test_get_manager(self, mock_manager):
sys_inst = self.hpe_sushy.get_manager('1234') sys_inst = self.hpe_sushy.get_manager('1234')
self.assertTrue(isinstance(sys_inst, self.assertIsInstance(sys_inst,
manager.HPEManager.__class__)) manager.HPEManager.__class__)
mock_manager.assert_called_once_with(self.hpe_sushy._conn, mock_manager.assert_called_once_with(self.hpe_sushy._conn,
'1234', '1234',
self.hpe_sushy.redfish_version) self.hpe_sushy.redfish_version)