sns
- class moto.sns.models.SNSBackend(region_name: str, account_id: str)
Responsible for mocking calls to SNS. Integration with SQS/HTTP/etc is supported.
If you’re using the decorators, you can verify the message signature send to an HTTP endpoint.
Messages published to a topic are persisted in the backend. If you need to verify that a message was published successfully, you can use the internal API to check the message was published successfully:
from moto.core import DEFAULT_ACCOUNT_ID from moto.sns import sns_backends sns_backend = sns_backends[DEFAULT_ACCOUNT_ID]["us-east-1"] # Use the appropriate account/region all_send_notifications = sns_backend.topics[topic_arn].sent_notifications
Note that, as this is an internal API, the exact format may differ per versions.
Implemented features for this service
[X] add_permission
[X] check_if_phone_number_is_opted_out
Current implementation returns True for all numbers ending in ‘99’
[X] confirm_subscription
[X] create_platform_application
[X] create_platform_endpoint
[ ] create_sms_sandbox_phone_number
[X] create_topic
[X] delete_endpoint
[X] delete_platform_application
[ ] delete_sms_sandbox_phone_number
[X] delete_topic
[ ] get_data_protection_policy
[X] get_endpoint_attributes
[X] get_platform_application_attributes
[X] get_sms_attributes
[ ] get_sms_sandbox_account_status
[X] get_subscription_attributes
[X] get_topic_attributes
[X] list_endpoints_by_platform_application
[ ] list_origination_numbers
[X] list_phone_numbers_opted_out
[X] list_platform_applications
[ ] list_sms_sandbox_phone_numbers
[X] list_subscriptions
[X] list_subscriptions_by_topic
[X] list_tags_for_resource
[X] list_topics
[X] opt_in_phone_number
[X] publish
[X] publish_batch
The MessageDeduplicationId-parameter has not yet been implemented.
[ ] put_data_protection_policy
[X] remove_permission
[X] set_endpoint_attributes
[X] set_platform_application_attributes
[X] set_sms_attributes
[X] set_subscription_attributes
[ ] set_topic_attributes
[X] subscribe
[X] tag_resource
[X] unsubscribe
[X] untag_resource
[ ] verify_sms_sandbox_phone_number