

def test_pvremove(self):
    '\n        Tests for remove a physical device being used as an LVM physical volume\n        '
    pvdisplay = MagicMock(return_value=False)
    with patch('salt.modules.linux_lvm.pvdisplay', pvdisplay):
        self.assertRaises(CommandExecutionError, linux_lvm.pvremove, 'A', override=False)
    pvdisplay = MagicMock(return_value=False)
    with patch('salt.modules.linux_lvm.pvdisplay', pvdisplay):
        mock = MagicMock(return_value=True)
        with patch.dict(linux_lvm.__salt__, {
            'lvm.pvdisplay': mock,
        }):
            ret = {
                'stdout': 'saltines',
                'stderr': 'cheese',
                'retcode': 0,
                'pid': '1337',
            }
            mock = MagicMock(return_value=ret)
            with patch.dict(linux_lvm.__salt__, {
                'cmd.run_all': mock,
            }):
                self.assertEqual(linux_lvm.pvremove('A'), True)

dataset/ETHPy150Open saltstack/salt/tests/unit/modules/linux_lvm_test.py LinuxLVMTestCase.test_pvremove/original