From 18bad6994d65ae97db45b3b26bfd5766af6e5a0b Mon Sep 17 00:00:00 2001 From: Ghalib Suleiman Date: Fri, 29 Aug 2014 15:13:59 -0600 Subject: [PATCH] Creating a queue with existing name is now a no-op This is more in line with Amazon's CreateQueue API (http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_CreateQueue.html). Previously, calling create_queue with a name that already existed would cause moto to overwrite the existing queue with a new empty one. --- moto/sqs/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moto/sqs/models.py b/moto/sqs/models.py index 0299f479c..d71dfef6a 100644 --- a/moto/sqs/models.py +++ b/moto/sqs/models.py @@ -158,8 +158,10 @@ class SQSBackend(BaseBackend): super(SQSBackend, self).__init__() def create_queue(self, name, visibility_timeout): - queue = Queue(name, visibility_timeout) - self.queues[name] = queue + queue = self.queues.get(name) + if queue is None: + queue = Queue(name, visibility_timeout) + self.queues[name] = queue return queue def list_queues(self, queue_name_prefix):