Пример #1
0
    def test_publish_to_target_plain(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)

        assert 'MessageId' in response
Пример #2
0
    def test_publish_to_target(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)

        self.assertTrue('MessageId' in response)
Пример #3
0
    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',
                                          })

        assert 'MessageId' in response
Пример #4
0
 def test_get_conn_returns_a_boto3_connection(self):
     hook = AwsSnsHook(aws_conn_id='aws_default')
     self.assertIsNotNone(hook.get_conn())
Пример #5
0
 def test_get_conn_returns_a_boto3_connection(self):
     hook = AwsSnsHook(aws_conn_id='aws_default')
     self.assertIsNotNone(hook.get_conn())