def test_detect_hardware_error(self, mocked_open, mock_listdir): mock_listdir.return_value = ['eth0', 'ib0'] mocked_open.return_value.__enter__ = lambda s: s mocked_open.return_value.__exit__ = mock.Mock() read_mock = mocked_open.return_value.read read_mock.side_effect = ['0x8086\n', OSError('boom')] self.assertFalse(mlnx._detect_hardware())
def test_detect_hardware_error(self, mocked_open, mock_listdir): mock_listdir.return_value = ['eth0', 'ib0'] mocked_open.return_value.__enter__ = lambda s: s mocked_open.return_value.__exit__ = mock.Mock() read_mock = mocked_open.return_value.read read_mock.side_effect = ['0x8086\n', OSError('boom')] self.assertFalse(mlnx._detect_hardware())
def test_detect_hardware_error(self, mocked_get_device_info, mock_listdir): mock_listdir.return_value = ['eth0', 'ib0'] mocked_get_device_info.side_effect = ['0x8086', None] self.assertFalse(mlnx._detect_hardware())
def test_detect_hardware(self, mocked_get_device_info, mock_listdir): mock_listdir.return_value = ['eth0', 'ib0'] mocked_get_device_info.side_effect = ['0x8086', '0x15b3'] self.assertTrue(mlnx._detect_hardware())
def test_detect_hardware_error( self, mocked_get_device_info, mock_listdir): mock_listdir.return_value = ['eth0', 'ib0'] mocked_get_device_info.side_effect = ['0x8086', None] self.assertFalse(mlnx._detect_hardware())
def test_detect_hardware(self, mocked_get_device_info, mock_listdir): mock_listdir.return_value = ['eth0', 'ib0'] mocked_get_device_info.side_effect = ['0x8086', '0x15b3'] self.assertTrue(mlnx._detect_hardware())