From c25aae0d9ab185e06718144fbbf1f68bade2b73d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristopher=20Pinz=C3=B3n?= Date: Mon, 7 Feb 2022 18:53:25 -0500 Subject: [PATCH] Allow "True" in SQS Queue boolean attributes (#4830) --- moto/sqs/models.py | 2 +- .../test_cloudformation_stack_crud_boto3.py | 2 +- tests/test_sqs/test_sqs.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/moto/sqs/models.py b/moto/sqs/models.py index e4cea5259..234862ed9 100644 --- a/moto/sqs/models.py +++ b/moto/sqs/models.py @@ -327,7 +327,7 @@ class Queue(CloudFormationModel): if key in integer_fields: value = int(value) if key in bool_fields: - value = value == "true" + value = str(value).lower() == "true" if key in ["Policy", "RedrivePolicy"] and value is not None: continue diff --git a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py index 21f2d29fd..e3171a6b5 100644 --- a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py +++ b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py @@ -264,7 +264,7 @@ dummy_redrive_template = { }, "DeadLetterQueue": { "Type": "AWS::SQS::Queue", - "Properties": {"FifoQueue": True}, + "Properties": {"QueueName": "deadletterqueue.fifo", "FifoQueue": True}, }, }, } diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py index 9ab134062..103deed19 100644 --- a/tests/test_sqs/test_sqs.py +++ b/tests/test_sqs/test_sqs.py @@ -95,12 +95,12 @@ def test_create_queue_with_different_attributes_fail(): raise RuntimeError("Should of raised QueueAlreadyExists Exception") q_name2 = str(uuid4())[0:6] - response = sqs.create_queue(QueueName=q_name2, Attributes={"FifoQueue": "True"}) + response = sqs.create_queue(QueueName=q_name2, Attributes={"FifoQueue": "tru"}) attributes = {"VisibilityTimeout": "60"} sqs.set_queue_attributes(QueueUrl=response.get("QueueUrl"), Attributes=attributes) - new_response = sqs.create_queue(QueueName=q_name2, Attributes={"FifoQueue": "True"}) + new_response = sqs.create_queue(QueueName=q_name2, Attributes={"FifoQueue": "tru"}) new_response["QueueUrl"].should.equal(response.get("QueueUrl"))