Best Python code snippet using localstack_python
test_sns.py
Source:test_sns.py
...1117 assert e.match("MessageGroupId")1118 self.sns_client.delete_topic(TopicArn=topic_arn)1119 self.sns_client.delete_topic(TopicArn=fifo_topic_arn)1120 self.sqs_client.delete_queue(QueueUrl=fifo_queue_url)1121def test_empty_sns_message(sns_client, sqs_client, sns_topic, sqs_queue):1122 topic_arn = sns_topic["Attributes"]["TopicArn"]1123 queue_arn = sqs_client.get_queue_attributes(QueueUrl=sqs_queue, AttributeNames=["QueueArn"])[1124 "Attributes"1125 ]["QueueArn"]1126 sns_client.subscribe(TopicArn=topic_arn, Protocol="sqs", Endpoint=queue_arn)1127 with pytest.raises(ClientError) as e:1128 sns_client.publish(Message="", TopicArn=topic_arn)1129 assert e.match("Empty message")1130 assert (1131 sqs_client.get_queue_attributes(1132 QueueUrl=sqs_queue, AttributeNames=["ApproximateNumberOfMessages"]1133 )["Attributes"]["ApproximateNumberOfMessages"]1134 == "0"1135 )
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!!