Example #1
0
    def test_vg_absent(self):
        """
        Test to remove an LVM volume group
        """
        name = "testvg00"

        comt = "Volume Group {} already absent".format(name)

        ret = {"name": name, "changes": {}, "result": True, "comment": comt}

        mock = MagicMock(side_effect=[False, True])
        with patch.dict(lvm.__salt__, {"lvm.vgdisplay": mock}):
            self.assertDictEqual(lvm.vg_absent(name), ret)

            comt = "Volume Group {} is set to be removed".format(name)
            ret.update({"comment": comt, "result": None})
            with patch.dict(lvm.__opts__, {"test": True}):
                self.assertDictEqual(lvm.vg_absent(name), ret)
Example #2
0
    def test_vg_absent(self):
        '''
        Test to remove an LVM volume group
        '''
        name = '/dev/sda5'

        comt = ('Volume Group {0} already absent'.format(name))

        ret = {'name': name,
               'changes': {},
               'result': True,
               'comment': comt}

        mock = MagicMock(side_effect=[False, True])
        with patch.dict(lvm.__salt__, {'lvm.vgdisplay': mock}):
            self.assertDictEqual(lvm.vg_absent(name), ret)

            comt = ('Volume Group {0} is set to be removed'.format(name))
            ret.update({'comment': comt, 'result': None})
            with patch.dict(lvm.__opts__, {'test': True}):
                self.assertDictEqual(lvm.vg_absent(name), ret)