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