Best Python code snippet using localstack_python
test_sns.py
Source:test_sns.py  
...1643        response = sqs_client.receive_message(QueueUrl=dlq_url, WaitTimeSeconds=2)1644        # AWS doesn't send to the DLQ if the UnsubscribeConfirmation fails to be delivered1645        assert "Messages" not in response1646    @pytest.mark.aws_validated1647    def test_publish_too_long_message(self, sns_client, sns_create_topic):1648        topic_arn = sns_create_topic()["TopicArn"]1649        # simulate payload over 256kb1650        message = "This is a test message" * 120001651        with pytest.raises(ClientError) as e:1652            sns_client.publish(TopicArn=topic_arn, Message=message)1653        assert e.value.response["Error"]["Code"] == "InvalidParameter"1654        assert e.value.response["Error"]["Message"] == "Invalid parameter: Message too long"1655        assert e.value.response["ResponseMetadata"]["HTTPStatusCode"] == 4001656    @pytest.mark.only_localstack  # needs real credentials for GCM/FCM1657    def test_publish_to_gcm(self, sns_client):1658        key = "mock_server_key"1659        token = "mock_token"1660        platform_app_arn = sns_client.create_platform_application(1661            Name="firebase", Platform="GCM", Attributes={"PlatformCredential": key}...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
