Merge pull request #2538 from edekadigital/fix-sns-subscribe-sms-validation
Fix sns.subscribe validation for sms numbers
This commit is contained in:
commit
b19abbc63e
3 changed files with 28 additions and 10 deletions
|
|
@ -19,7 +19,10 @@ def test_subscribe_sms():
|
|||
arn = resp["TopicArn"]
|
||||
|
||||
resp = client.subscribe(TopicArn=arn, Protocol="sms", Endpoint="+15551234567")
|
||||
resp.should.contain("SubscriptionArn")
|
||||
resp.should.have.key("SubscriptionArn")
|
||||
|
||||
resp = client.subscribe(TopicArn=arn, Protocol="sms", Endpoint="+15/55-123.4567")
|
||||
resp.should.have.key("SubscriptionArn")
|
||||
|
||||
|
||||
@mock_sns
|
||||
|
|
@ -51,6 +54,18 @@ def test_subscribe_bad_sms():
|
|||
except ClientError as err:
|
||||
err.response["Error"]["Code"].should.equal("InvalidParameter")
|
||||
|
||||
client.subscribe.when.called_with(
|
||||
TopicArn=arn, Protocol="sms", Endpoint="+15--551234567"
|
||||
).should.throw(ClientError, "Invalid SMS endpoint: +15--551234567")
|
||||
|
||||
client.subscribe.when.called_with(
|
||||
TopicArn=arn, Protocol="sms", Endpoint="+15551234567."
|
||||
).should.throw(ClientError, "Invalid SMS endpoint: +15551234567.")
|
||||
|
||||
client.subscribe.when.called_with(
|
||||
TopicArn=arn, Protocol="sms", Endpoint="/+15551234567"
|
||||
).should.throw(ClientError, "Invalid SMS endpoint: /+15551234567")
|
||||
|
||||
|
||||
@mock_sns
|
||||
def test_creating_subscription():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue