diff --git a/moto/core/responses.py b/moto/core/responses.py index 79b0af637..4c957e50e 100644 --- a/moto/core/responses.py +++ b/moto/core/responses.py @@ -81,7 +81,8 @@ class _TemplateEnvironmentMixin(object): template_id = id(source) if not self.contains_template(template_id): self.loader.update({template_id: source}) - self.environment = Environment(loader=self.loader, autoescape=self.should_autoescape) + self.environment = Environment(loader=self.loader, autoescape=self.should_autoescape, trim_blocks=True, + lstrip_blocks=True) return self.environment.get_template(template_id) diff --git a/moto/sqs/responses.py b/moto/sqs/responses.py index 7d37c44fb..2d9a34880 100644 --- a/moto/sqs/responses.py +++ b/moto/sqs/responses.py @@ -245,9 +245,7 @@ CREATE_QUEUE_RESPONSE = """ {{ queue.visibility_timeout }} - - 7a62c49f-347e-4fc4-9331-6e8e7a96aa73 - + 7a62c49f-347e-4fc4-9331-6e8e7a96aa73 """ @@ -267,17 +265,13 @@ LIST_QUEUES_RESPONSE = """ {% endfor %} - - 725275ae-0b9b-4762-b238-436d7c65a1ac - + 725275ae-0b9b-4762-b238-436d7c65a1ac """ DELETE_QUEUE_RESPONSE = """ - - 6fde8d1e-52cd-4581-8cd9-c512f4c64223 - + 6fde8d1e-52cd-4581-8cd9-c512f4c64223 """ @@ -297,28 +291,24 @@ GET_QUEUE_ATTRIBUTES_RESPONSE = """ SET_QUEUE_ATTRIBUTE_RESPONSE = """ - - e5cca473-4fc0-4198-a451-8abb94d02c75 - + e5cca473-4fc0-4198-a451-8abb94d02c75 """ SEND_MESSAGE_RESPONSE = """ - {{ message.md5 }} + {{- message.md5 -}} {% if message.message_attributes.items()|count > 0 %} 324758f82d026ac6ec5b31a3b192d1e3 {% endif %} - {{ message.id }} + {{- message.id -}} - - 27daac76-34dd-47df-bd01-1f6e873584a0 - + 27daac76-34dd-47df-bd01-1f6e873584a0 """ @@ -366,9 +356,7 @@ RECEIVE_MESSAGE_RESPONSE = """ {% endfor %} - - b6633655-283d-45b4-aee4-4e84e0ae6afa - + b6633655-283d-45b4-aee4-4e84e0ae6afa """ @@ -392,9 +380,7 @@ SEND_MESSAGE_BATCH_RESPONSE = """ DELETE_MESSAGE_RESPONSE = """ - - b5293cb5-d306-4a17-9048-b263635abe42 - + b5293cb5-d306-4a17-9048-b263635abe42 """ @@ -413,17 +399,13 @@ DELETE_MESSAGE_BATCH_RESPONSE = """ CHANGE_MESSAGE_VISIBILITY_RESPONSE = """ - - 6a7a282a-d013-4a59-aba9-335b0fa48bed - + 6a7a282a-d013-4a59-aba9-335b0fa48bed """ PURGE_QUEUE_RESPONSE = """ - - 6fde8d1e-52cd-4581-8cd9-c512f4c64223 - + 6fde8d1e-52cd-4581-8cd9-c512f4c64223 """ diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py index cc7ac7d10..8e26a63d7 100644 --- a/tests/test_sqs/test_sqs.py +++ b/tests/test_sqs/test_sqs.py @@ -487,7 +487,11 @@ boto3 def test_boto3_message_send(): sqs = boto3.resource('sqs', region_name='us-east-1') queue = sqs.create_queue(QueueName="blah") - queue.send_message(MessageBody="derp") + msg = queue.send_message(MessageBody="derp") + + msg.get('MD5OfMessageBody').should.equal('58fd9edd83341c29f1aebba81c31e257') + msg.get('ResponseMetadata', {}).get('RequestId').should.equal('27daac76-34dd-47df-bd01-1f6e873584a0') + msg.get('MessageId').should_not.contain(' \n') messages = queue.receive_messages() messages.should.have.length_of(1)