def test_absent(): """ Test to ensure the named launch configuration is deleted. """ name = "mylc" ret = {"name": name, "result": True, "changes": {}, "comment": ""} mock = MagicMock(side_effect=[False, True]) with patch.dict(boto_lc.__salt__, {"boto_asg.launch_configuration_exists": mock}): comt = "Launch configuration does not exist." ret.update({"comment": comt}) assert boto_lc.absent(name) == ret with patch.dict(boto_lc.__opts__, {"test": True}): comt = "Launch configuration set to be deleted." ret.update({"comment": comt, "result": None}) assert boto_lc.absent(name) == ret
def test_absent(self): ''' Test to ensure the named launch configuration is deleted. ''' name = 'mylc' ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} mock = MagicMock(side_effect=[False, True]) with patch.dict(boto_lc.__salt__, {'boto_asg.launch_configuration_exists': mock}): comt = ('Launch configuration does not exist.') ret.update({'comment': comt}) self.assertDictEqual(boto_lc.absent(name), ret) with patch.dict(boto_lc.__opts__, {'test': True}): comt = ('Launch configuration set to be deleted.') ret.update({'comment': comt, 'result': None}) self.assertDictEqual(boto_lc.absent(name), ret)