def test_multipath_flush(self): ''' Test for Device-Mapper Multipath flush ''' mock = MagicMock(return_value=False) with patch.object(os.path, 'exists', mock): self.assertEqual(devmap.multipath_flush('device'), 'device does not exist') mock = MagicMock(return_value=True) with patch.object(os.path, 'exists', mock): mock = MagicMock(return_value='A') with patch.dict(devmap.__salt__, {'cmd.run': mock}): self.assertEqual(devmap.multipath_flush('device'), ['A'])
def test_multipath_flush(self): """ Test for Device-Mapper Multipath flush """ mock = MagicMock(return_value=False) with patch.object(os.path, "exists", mock): self.assertEqual(devmap.multipath_flush("device"), "device does not exist") mock = MagicMock(return_value=True) with patch.object(os.path, "exists", mock): mock = MagicMock(return_value="A") with patch.dict(devmap.__salt__, {"cmd.run": mock}): self.assertEqual(devmap.multipath_flush("device"), ["A"])