def test_exists(self): ''' Test to ensure the SQS queue exists. ''' name = 'myqueue' region = 'eu-west-1' ret = {'name': name, 'result': None, 'changes': {}, 'comment': ''} mock = MagicMock(side_effect=[False, True]) with patch.dict(aws_sqs.__salt__, {'aws_sqs.queue_exists': mock}): comt = 'AWS SQS queue {0} is set to be created'.format(name) ret.update({'comment': comt}) with patch.dict(aws_sqs.__opts__, {'test': True}): self.assertDictEqual(aws_sqs.exists(name, region), ret) comt = u'{0} exists in {1}'.format(name, region) ret.update({'comment': comt, 'result': True}) self.assertDictEqual(aws_sqs.exists(name, region), ret)
def test_exists(self): """ Test to ensure the SQS queue exists. """ name = "myqueue" region = "eu-west-1" ret = {"name": name, "result": None, "changes": {}, "comment": ""} mock = MagicMock(side_effect=[False, True]) with patch.dict(aws_sqs.__salt__, {"aws_sqs.queue_exists": mock}): comt = "AWS SQS queue {0} is set to be created".format(name) ret.update({"comment": comt}) with patch.dict(aws_sqs.__opts__, {"test": True}): self.assertDictEqual(aws_sqs.exists(name, region), ret) comt = "{0} exists in {1}".format(name, region) ret.update({"comment": comt, "result": True}) self.assertDictEqual(aws_sqs.exists(name, region), ret)