SNS: do not duplicate subscriptions

This commit is contained in:
Boris Gvozdev 2018-01-02 11:30:39 +11:00
commit 633decc6c0
2 changed files with 27 additions and 0 deletions

View file

@ -25,6 +25,23 @@ def test_subscribe_sms():
)
resp.should.contain('SubscriptionArn')
@mock_sns
def test_double_subscription():
client = boto3.client('sns', region_name='us-east-1')
client.create_topic(Name="some-topic")
resp = client.create_topic(Name="some-topic")
arn = resp['TopicArn']
do_subscribe_sqs = lambda sqs_arn: client.subscribe(
TopicArn=arn,
Protocol='sqs',
Endpoint=sqs_arn
)
resp1 = do_subscribe_sqs('arn:aws:sqs:elasticmq:000000000000:foo')
resp2 = do_subscribe_sqs('arn:aws:sqs:elasticmq:000000000000:foo')
resp1['SubscriptionArn'].should.equal(resp2['SubscriptionArn'])
@mock_sns
def test_subscribe_bad_sms():