def test_absent(): """ Test to verify that the overlay is absent. """ name = "sunrise" ret = {"name": name, "result": True, "comment": "", "changes": {}} mock = MagicMock(side_effect=[[], [name]]) with patch.dict(layman.__salt__, {"layman.list_local": mock}): comt = "Overlay {} already absent".format(name) ret.update({"comment": comt}) assert layman.absent(name) == ret with patch.dict(layman.__opts__, {"test": True}): comt = "Overlay {} is set to be deleted".format(name) ret.update({"comment": comt, "result": None}) assert layman.absent(name) == ret
def test_absent(self): ''' Test to verify that the overlay is absent. ''' name = 'sunrise' ret = {'name': name, 'result': True, 'comment': '', 'changes': {}} mock = MagicMock(side_effect=[[], [name]]) with patch.dict(layman.__salt__, {'layman.list_local': mock}): comt = ('Overlay {0} already absent'.format(name)) ret.update({'comment': comt}) self.assertDictEqual(layman.absent(name), ret) with patch.dict(layman.__opts__, {'test': True}): comt = ('Overlay {0} is set to be deleted'.format(name)) ret.update({'comment': comt, 'result': None}) self.assertDictEqual(layman.absent(name), ret)
def test_absent(self): """ Test to verify that the overlay is absent. """ name = "sunrise" ret = {"name": name, "result": True, "comment": "", "changes": {}} mock = MagicMock(side_effect=[[], [name]]) with patch.dict(layman.__salt__, {"layman.list_local": mock}): comt = "Overlay {0} already absent".format(name) ret.update({"comment": comt}) self.assertDictEqual(layman.absent(name), ret) with patch.dict(layman.__opts__, {"test": True}): comt = "Overlay {0} is set to be deleted".format(name) ret.update({"comment": comt, "result": None}) self.assertDictEqual(layman.absent(name), ret)