Repository: getmoto/moto

Issue:
I can't use RawMessageDelivery of messaging from sns to sqs
I implemented messaging from sns to sqs using `RawMessageDelivery`, but I could not get the expected value. 
Is `RawMessageDelivery` supported?
Or is there a problem with my code?

- my code (test.py)
```python
# -*- coding: utf-8 -*-

import boto3
from moto import mock_sqs, mock_sns
import json
import time
from pprint import pprint

mock_sns = mock_sns()
mock_sns.start()

mock_sqs = mock_sqs()
mock_sqs.start()

sns_client = boto3.client('sns')
topic_res = sns_client.create_topic(Name="topic_name")
sns_topic_arn = topic_res['TopicArn']

sqs_client = boto3.client('sqs')
queue_url = sqs_client.create_queue(
    QueueName="queue_name"
)['QueueUrl']
sqs_queue_arn = sqs_client.get_queue_attributes(QueueUrl=queue_url,
                                                AttributeNames=['All'])['Attributes']['QueueArn']

subscribe = sns_client.subscribe(
    TopicArn=sns_topic_arn,
    Protocol='sqs',
    Endpoint=sqs_queue_arn
)
subscribe_arn = subscribe["SubscriptionArn"]
sns_client.set_subscription_attributes(
    SubscriptionArn=subscribe_arn,
    AttributeName='RawMessageDelivery',
    AttributeValue='true'
)

# send message
boto3.resource('sns').Topic(sns_topic_arn).publish(Message=json.dumps({"this": "that"}), MessageStructure='json')

time.sleep(10)

# receive message
queue = boto3.resource('sqs').get_queue_by_name(QueueName="queue_name")
msg = queue.receive_messages(
    MaxNumberOfMessages=1,
    WaitTimeSeconds=20,
    VisibilityTimeout=10
)[0]

pprint(msg.body)

mock_sqs.stop()
mock_sns.stop()
```
- return
```bash
$ python test.py
('{\n'
 '  "Message": "{\\"this\\": \\"that\\"}",\n'
 '  "MessageId": "7753f915-78d8-4490-b5fa-5770daf0ac30",\n'
 '  "Signature": '
 '"EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",\n'
 '  "SignatureVersion": "1",\n'
 '  "SigningCertURL": '
 '"https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",\n'
 '  "Subject": "my subject",\n'
 '  "Timestamp": "2018-04-17T11:00:32.251Z",\n'
 '  "TopicArn": "arn:aws:sns:ap-northeast-1:123456789012:topic_name",\n'
 '  "Type": "Notification",\n'
 '  "UnsubscribeURL": '
 '"https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:123456789012:some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"\n'
 '}')
```
- expect message
```
{"Message": {"this": "that"}}
```
- environment
```bash
$ python -V
Python 3.6.3 :: Anaconda, Inc.
$ pip freeze | grep boto
boto==2.48.0
boto3==1.7.4
botocore==1.10.4
$ pip freeze | grep moto
moto==1.3.2
```


Discussion:

Resolving patch:
diff --git a/moto/sns/models.py b/moto/sns/models.py
--- a/moto/sns/models.py
+++ b/moto/sns/models.py
@@ -94,7 +94,10 @@ def publish(self, message, message_id, subject=None,
         if self.protocol == 'sqs':
             queue_name = self.endpoint.split(":")[-1]
             region = self.endpoint.split(":")[3]
-            enveloped_message = json.dumps(self.get_post_data(message, message_id, subject, message_attributes=message_attributes), sort_keys=True, indent=2, separators=(',', ': '))
+            if self.attributes.get('RawMessageDelivery') != 'true':
+                enveloped_message = json.dumps(self.get_post_data(message, message_id, subject, message_attributes=message_attributes), sort_keys=True, indent=2, separators=(',', ': '))
+            else:
+                enveloped_message = message
             sqs_backends[region].send_message(queue_name, enveloped_message)
         elif self.protocol in ['http', 'https']:
             post_data = self.get_post_data(message, message_id, subject)


Test patch:
diff --git a/tests/test_sns/test_publishing_boto3.py b/tests/test_sns/test_publishing_boto3.py
--- a/tests/test_sns/test_publishing_boto3.py
+++ b/tests/test_sns/test_publishing_boto3.py
@@ -42,6 +42,29 @@ def test_publish_to_sqs():
     acquired_message.should.equal(expected)
 
 
+@mock_sqs
+@mock_sns
+def test_publish_to_sqs_raw():
+    sns = boto3.resource('sns', region_name='us-east-1')
+    topic = sns.create_topic(Name='some-topic')
+
+    sqs = boto3.resource('sqs', region_name='us-east-1')
+    queue = sqs.create_queue(QueueName='test-queue')
+
+    subscription = topic.subscribe(
+        Protocol='sqs', Endpoint=queue.attributes['QueueArn'])
+
+    subscription.set_attributes(
+        AttributeName='RawMessageDelivery', AttributeValue='true')
+
+    message = 'my message'
+    with freeze_time("2015-01-01 12:00:00"):
+        topic.publish(Message=message)
+
+    messages = queue.receive_messages(MaxNumberOfMessages=1)
+    messages[0].body.should.equal(message)
+
+
 @mock_sqs
 @mock_sns
 def test_publish_to_sqs_bad():