Permalink
Browse files

Refactor sns-sqs subscribe method to use arn property

  • Loading branch information...
1 parent 5222d9e commit 25c044eb5d08e2d946b4658299feeeaa297e7df4 @jamesls jamesls committed Jan 3, 2013
Showing with 3 additions and 6 deletions.
  1. +1 −2 boto/sns/connection.py
  2. +2 −4 tests/unit/sns/test_connection.py
View
@@ -308,8 +308,7 @@ def subscribe_sqs_queue(self, topic, queue):
:param queue: The queue you wish to subscribe to the SNS Topic.
"""
t = queue.id.split('/')
- q_arn = 'arn:aws:sqs:%s:%s:%s' % (queue.connection.region.name,
- t[1], t[2])
+ q_arn = queue.arn
resp = self.subscribe(topic, 'sqs', q_arn)
attr = queue.get_attributes('Policy')
if 'Policy' in attr:
@@ -50,8 +50,7 @@ def test_sqs_with_existing_policy(self):
queue = Mock()
queue.get_attributes.return_value = QUEUE_POLICY
- queue.id = '/idnum/queuename'
- queue.connection.region.name = 'us-east-1'
+ queue.arn = 'arn:aws:sqs:us-east-1:idnum:queuename'
self.service_connection.subscribe_sqs_queue('topic_arn', queue)
self.assert_request_parameters({
@@ -78,8 +77,7 @@ def test_sqs_with_no_previous_policy(self):
queue = Mock()
queue.get_attributes.return_value = {}
- queue.id = '/idnum/queuename'
- queue.connection.region.name = 'us-east-1'
+ queue.arn = 'arn:aws:sqs:us-east-1:idnum:queuename'
self.service_connection.subscribe_sqs_queue('topic_arn', queue)
self.assert_request_parameters({

0 comments on commit 25c044e

Please sign in to comment.