You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/02/18 18:32:16 UTC

[GitHub] [airflow] snazzyfox commented on a change in pull request #7451: [AIRFLOW-6830] Add Subject/MessageAttributes to SNS hook and operator

snazzyfox commented on a change in pull request #7451: [AIRFLOW-6830] Add Subject/MessageAttributes to SNS hook and operator
URL: https://github.com/apache/airflow/pull/7451#discussion_r380856952
 
 

 ##########
 File path: tests/providers/amazon/aws/hooks/test_sns.py
 ##########
 @@ -49,7 +49,24 @@ def test_publish_to_target(self):
         self.assertTrue('MessageId' in response)
 
     @mock_sns
-    def test_publish_to_target_without_subject(self):
+    def test_publish_to_target_with_attributes(self):
+        hook = AwsSnsHook(aws_conn_id='aws_default')
+
+        message = "Hello world"
+        topic_name = "test-topic"
+        target = hook.get_conn().create_topic(Name=topic_name).get('TopicArn')
+
+        response = hook.publish_to_target(target, message, message_attributes={
+            'test-string': 'string-value',
+            'test-number': 123456,
+            'test-array': ['first', 'second', 'third'],
+            'test-binary': b'binary-value',
+        })
+
+        self.assertTrue('MessageId' in response)
 
 Review comment:
   I used assertTrue since that's used in the rest of these tests. Should I update those as well?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services