Best Python code snippet using localstack_python
test_sns.py
Source:test_sns.py
...220 retry(check_message, retries=PUBLICATION_RETRIES, sleep=PUBLICATION_TIMEOUT)221 # clean up222 self.sqs_client.delete_queue(QueueUrl=queue_url)223 self.sns_client.unsubscribe(SubscriptionArn=subscription['SubscriptionArn'])224 def test_subscribe_platform_endpoint(self):225 sns = self.sns_client226 app_arn = sns.create_platform_application(Name='app1', Platform='p1', Attributes={})['PlatformApplicationArn']227 platform_arn = sns.create_platform_endpoint(PlatformApplicationArn=app_arn, Token='token_1')['EndpointArn']228 subscription = self._publish_sns_message_with_attrs(platform_arn, 'application')229 # assert that message has been received230 def check_message():231 self.assertGreater(len(sns_listener.PLATFORM_ENDPOINT_MESSAGES[platform_arn]), 0)232 retry(check_message, retries=PUBLICATION_RETRIES, sleep=PUBLICATION_TIMEOUT)233 # clean up234 sns.unsubscribe(SubscriptionArn=subscription['SubscriptionArn'])235 sns.delete_endpoint(EndpointArn=platform_arn)236 sns.delete_platform_application(PlatformApplicationArn=app_arn)237 def _publish_sns_message_with_attrs(self, endpoint_arn, protocol):238 # create subscription with filter policy...
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!!