Best Python code snippet using localstack_python
test_sns.py
Source:test_sns.py  
...393                json.loads(json.loads(result['Messages'][0]['Body'])['Message'][0])['message'],394                'test_redrive_policy'395            )396        retry(receive_dlq, retries=7, sleep=2.5)397    def test_redrive_policy_lambda_subscription(self):398        self.unsubscribe_all_from_sns()399        lambda_name = 'test-%s' % short_uid()400        lambda_arn = aws_stack.lambda_function_arn(lambda_name)401        testutil.create_lambda_function(func_name=lambda_name, libs=TEST_LAMBDA_LIBS,402            handler_file=TEST_LAMBDA_PYTHON, runtime=LAMBDA_RUNTIME_PYTHON36)403        subscription = self.sns_client.subscribe(TopicArn=self.topic_arn, Protocol='lambda', Endpoint=lambda_arn)404        self.sns_client.set_subscription_attributes(405            SubscriptionArn=subscription['SubscriptionArn'],406            AttributeName='RedrivePolicy',407            AttributeValue=json.dumps({'deadLetterTargetArn': aws_stack.sqs_queue_arn(TEST_QUEUE_DLQ_NAME)})408        )409        testutil.delete_lambda_function(lambda_name)410        self.sns_client.publish(TopicArn=self.topic_arn, Message=json.dumps({'message': 'test_redrive_policy'}))411        def receive_dlq():...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!!
