Fix creating SQS queue with same attributes. Closes #1663.

This commit is contained in:
Steve Pulec 2018-05-31 23:05:50 -04:00
commit 1689a2808f
4 changed files with 40 additions and 1 deletions

View file

@ -18,6 +18,7 @@ from .exceptions import (
MessageAttributesInvalid,
MessageNotInflight,
QueueDoesNotExist,
QueueAlreadyExists,
ReceiptHandleIsInvalid,
)
@ -383,7 +384,12 @@ class SQSBackend(BaseBackend):
def create_queue(self, name, **kwargs):
queue = self.queues.get(name)
if queue is None:
if queue:
# Queue already exist. If attributes don't match, throw error
for key, value in kwargs.items():
if getattr(queue, camelcase_to_underscores(key)) != value:
raise QueueAlreadyExists("The specified queue already exists.")
else:
try:
kwargs.pop('region')
except KeyError: