def test_present(): """ Test to verify that the overlay is present. """ 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 present".format(name) ret.update({"comment": comt}) assert layman.present(name) == ret with patch.dict(layman.__opts__, {"test": True}): comt = "Overlay {} is set to be added".format(name) ret.update({"comment": comt, "result": None}) assert layman.present(name) == ret
def test_present(self): ''' Test to verify that the overlay is present. ''' 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 present'.format(name)) ret.update({'comment': comt}) self.assertDictEqual(layman.present(name), ret) with patch.dict(layman.__opts__, {'test': True}): comt = ('Overlay {0} is set to be added'.format(name)) ret.update({'comment': comt, 'result': None}) self.assertDictEqual(layman.present(name), ret)
def test_present(self): """ Test to verify that the overlay is present. """ 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 present".format(name) ret.update({"comment": comt}) self.assertDictEqual(layman.present(name), ret) with patch.dict(layman.__opts__, {"test": True}): comt = "Overlay {0} is set to be added".format(name) ret.update({"comment": comt, "result": None}) self.assertDictEqual(layman.present(name), ret)