def test_absent(self): ''' Test to ensure the named sqs queue is deleted. ''' name = 'test.example.com.' base_ret = {'name': name, 'changes': {}} mock = MagicMock(side_effect=[{'result': False}, {'result': True}]) with patch.dict(boto_sqs.__salt__, {'boto_sqs.exists': mock}): comt = ('SQS queue {0} does not exist in None.'.format(name)) ret = base_ret.copy() ret.update({'result': True, 'comment': comt}) self.assertDictEqual(boto_sqs.absent(name), ret) with patch.dict(boto_sqs.__opts__, {'test': True}): comt = ('SQS queue {0} is set to be removed.'.format(name)) ret = base_ret.copy() ret.update({ 'result': None, 'comment': comt, 'pchanges': { 'old': name, 'new': None }, }) self.assertDictEqual(boto_sqs.absent(name), ret)
def test_absent(self): """ Test to ensure the named sqs queue is deleted. """ name = "test.example.com." base_ret = {"name": name, "changes": {}} mock = MagicMock(side_effect=[{"result": False}, {"result": True}]) with patch.dict(boto_sqs.__salt__, {"boto_sqs.exists": mock}): comt = "SQS queue {0} does not exist in None.".format(name) ret = base_ret.copy() ret.update({"result": True, "comment": comt}) self.assertDictEqual(boto_sqs.absent(name), ret) with patch.dict(boto_sqs.__opts__, {"test": True}): comt = "SQS queue {0} is set to be removed.".format(name) ret = base_ret.copy() ret.update({ "result": None, "comment": comt, "changes": { "old": name, "new": None }, }) self.assertDictEqual(boto_sqs.absent(name), ret)
def test_absent(self): ''' Test to ensure the named sqs queue is deleted. ''' name = 'test.example.com.' ret = {'name': name, 'result': True, 'changes': {}, 'comment': ''} mock = MagicMock(side_effect=[False, True]) with patch.dict(boto_sqs.__salt__, {'boto_sqs.exists': mock}): comt = ('{0} does not exist in None.'.format(name)) ret.update({'comment': comt}) self.assertDictEqual(boto_sqs.absent(name), ret) with patch.dict(boto_sqs.__opts__, {'test': True}): comt = ('AWS SQS queue {0} is set to be removed.'.format(name)) ret.update({'comment': comt, 'result': None}) self.assertDictEqual(boto_sqs.absent(name), ret)