Best Python code snippet using localstack_python
responses.py
Source:responses.py  
...114    def get_send_statistics(self):115        statistics = ses_backend.get_send_statistics()116        template = self.response_template(GET_SEND_STATISTICS)117        return template.render(all_statistics=[statistics])118    def create_configuration_set(self):119        configuration_set_name = self.querystring.get("ConfigurationSet.Name")[0]120        ses_backend.create_configuration_set(121            configuration_set_name=configuration_set_name122        )123        template = self.response_template(CREATE_CONFIGURATION_SET)124        return template.render()125    def create_configuration_set_event_destination(self):126        configuration_set_name = self._get_param("ConfigurationSetName")127        is_configuration_event_enabled = self.querystring.get(128            "EventDestination.Enabled"129        )[0]130        configuration_event_name = self.querystring.get("EventDestination.Name")[0]131        event_topic_arn = self.querystring.get(132            "EventDestination.SNSDestination.TopicARN"133        )[0]134        event_matching_types = self._get_multi_param(...handler.py
Source:handler.py  
...8    event_destination_name = env("EVENT_DESTINATION_NAME")9    def __init__(self):10        self.client = boto3.client("ses")11    def on_create(self, event):12        self.create_configuration_set(event)13        self.create_event_destination(event)14    def on_update(self, event):15        self.update_event_destination(event)16    def on_delete(self, event):17        self.delete_event_destination(event)18        self.delete_configuration_set(event)19    @staticmethod20    def get_topic_arn(event):21        return event["ResourceProperties"]["TopicARN"]22    def create_configuration_set(self, event):23        return self.client.create_configuration_set(24            ConfigurationSet={"Name": self.configuration_set_name}25        )26    def delete_configuration_set(self, event):27        return self.client.delete_configuration_set(28            ConfigurationSetName=self.configuration_set_name29        )30    def create_event_destination(self, event):31        return self.client.create_configuration_set_event_destination(32            **self.get_destination_config(event)33        )34    def update_event_destination(self, event):35        return self.client.update_configuration_set_event_destination(36            **self.get_destination_config(event)37        )...ses.py
Source:ses.py  
...7        self.platform = platform8    def verify(self):9        client = self.platform.get_client('ses')10        conf_name = self.platform.get_test_name()11        client.create_configuration_set(12            ConfigurationSet={13                'Name': conf_name14            }15        )16        assert any([conf for conf in client.list_configuration_sets()['ConfigurationSets']17                    if conf['Name'] == conf_name])18        client.delete_configuration_set(ConfigurationSetName=conf_name)19        with world.assert_raises(boto_exceptions.ClientError, 'ConfigurationSetDoesNotExist'):20            client.describe_configuration_set(ConfigurationSetName=conf_name)21    def verify_denied(self, error_text):22        client = self.platform.get_client('ses')23        with world.assert_raises(boto_exceptions.ClientError, error_text):24            client.list_configuration_sets()25    def verify_policy(self, prefix=False, pattern=False):26        client = self.platform.get_client('ses')27        if prefix:28            conf_name = self.platform.get_test_name('set_')29            with world.assert_raises(boto_exceptions.ClientError,30                                     "Action 'CreateConfigurationSet' violates policy 'csg.resource.name.prefix'"):31                client.create_configuration_set(32                    ConfigurationSet={33                        'Name': conf_name34                    }35                )36        if pattern:37            conf_name = 'tmp_%s' % self.platform.get_test_name()38            with world.assert_raises(boto_exceptions.ClientError,39                                     "Action 'CreateConfigurationSet' violates policy 'csg.resource.name.validation_pattern'"):40                client.create_configuration_set(41                    ConfigurationSet={42                        'Name': conf_name43                    }44                )45        conf_name = 'tmp_%s' % self.platform.get_test_name('set_')46        client.create_configuration_set(47            ConfigurationSet={48                'Name': conf_name49            }50        )51        assert any([conf for conf in client.list_configuration_sets()['ConfigurationSets']52                    if conf['Name'] == conf_name])...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!!
