Replace assertEqual(True/False, expr) with assertTrue/assertFalse in tests
In some cases, If the result of expr is a boolen value, we shoud use assertTrue/assertFalse to instead. Beacause it is clear and simple. Change-Id: Ie61369f6335a90b09bb24192282d33da5272c13f Story: #2003785 Task: #26490
This commit is contained in:
parent
677ff17006
commit
8a70f12435
@ -46,7 +46,7 @@ class TestIntelCnaHardwareManager(base.IronicAgentTest):
|
||||
|
||||
mock_listdir.return_value = ['eth0', 'eth1']
|
||||
mock_execute.side_effect = mock_return_execute
|
||||
self.assertEqual(True, cna._detect_cna_card())
|
||||
self.assertTrue(cna._detect_cna_card())
|
||||
|
||||
@mock.patch.object(os, 'listdir', autospec=True)
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@ -61,7 +61,7 @@ class TestIntelCnaHardwareManager(base.IronicAgentTest):
|
||||
|
||||
mock_listdir.return_value = ['eth0', 'eth1', 'eth2']
|
||||
mock_execute.side_effect = mock_return_execute
|
||||
self.assertEqual(False, cna._detect_cna_card())
|
||||
self.assertFalse(cna._detect_cna_card())
|
||||
|
||||
@mock.patch.object(os, 'listdir', autospec=True)
|
||||
@mock.patch.object(utils, 'execute', autospec=True)
|
||||
@ -74,7 +74,7 @@ class TestIntelCnaHardwareManager(base.IronicAgentTest):
|
||||
|
||||
mock_listdir.return_value = ['eth0', 'eth1']
|
||||
mock_execute.side_effect = mock_return_execute
|
||||
self.assertEqual(False, cna._detect_cna_card())
|
||||
self.assertFalse(cna._detect_cna_card())
|
||||
|
||||
@mock.patch.object(cna, 'LOG', autospec=True)
|
||||
@mock.patch.object(os, 'listdir', autospec=True)
|
||||
@ -87,7 +87,7 @@ class TestIntelCnaHardwareManager(base.IronicAgentTest):
|
||||
with mock.patch('six.moves.builtins.open', write_mock, create=True):
|
||||
cna._disable_embedded_lldp_agent_in_cna_card()
|
||||
write_mock().write.assert_called_with('lldp stop')
|
||||
self.assertEqual(False, mock_log.warning.called)
|
||||
self.assertFalse(mock_log.warning.called)
|
||||
|
||||
@mock.patch.object(cna, 'LOG', autospec=True)
|
||||
@mock.patch.object(os.path, 'exists', autospec=True)
|
||||
|
@ -451,7 +451,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
||||
(2, '02626172')],
|
||||
}
|
||||
result = self.hardware.collect_lldp_data(if_names)
|
||||
self.assertEqual(True, if_names[0] in result)
|
||||
self.assertIn(if_names[0], result)
|
||||
self.assertEqual(expected_lldp_data, result)
|
||||
|
||||
@mock.patch('ironic_python_agent.netutils.get_lldp_info', autospec=True)
|
||||
@ -485,7 +485,7 @@ class TestGenericHardwareManager(base.IronicAgentTest):
|
||||
}
|
||||
result = self.hardware.collect_lldp_data(if_names)
|
||||
mock_log.warning.assert_called_once()
|
||||
self.assertEqual(True, if_names[0] in result)
|
||||
self.assertIn(if_names[0], result)
|
||||
self.assertEqual(expected_lldp_data, result)
|
||||
|
||||
@mock.patch('ironic_python_agent.hardware._get_managers', autospec=True)
|
||||
|
Loading…
x
Reference in New Issue
Block a user