SNS - Enforce 'Message too long' exception when publishing messages
This commit is contained in:
parent
8092929258
commit
cd4dd3cfbf
2 changed files with 19 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ import sure # noqa
|
|||
|
||||
import responses
|
||||
from botocore.exceptions import ClientError
|
||||
from nose.tools import assert_raises
|
||||
from moto import mock_sns, mock_sqs
|
||||
|
||||
|
||||
|
|
@ -308,6 +309,20 @@ def test_publish_subject():
|
|||
raise RuntimeError('Should have raised an InvalidParameter exception')
|
||||
|
||||
|
||||
@mock_sns
|
||||
def test_publish_message_too_long():
|
||||
sns = boto3.resource('sns', region_name='us-east-1')
|
||||
topic = sns.create_topic(Name='some-topic')
|
||||
|
||||
with assert_raises(ClientError):
|
||||
topic.publish(
|
||||
Message="".join(["." for i in range(0, 262145)]))
|
||||
|
||||
# message short enough - does not raise an error
|
||||
topic.publish(
|
||||
Message="".join(["." for i in range(0, 262144)]))
|
||||
|
||||
|
||||
def _setup_filter_policy_test(filter_policy):
|
||||
sns = boto3.resource('sns', region_name='us-east-1')
|
||||
topic = sns.create_topic(Name='some-topic')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue