Best Python code snippet using localstack_python
apigwCORS.py
Source: apigwCORS.py
...56 "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",57 }58 )59 except apigwClient.exceptions.ConflictException as e:60 integrationResponse = apigwClient.delete_integration_response(61 restApiId = apigwId,62 resourceId = item['id'],63 httpMethod = "OPTIONS",64 statusCode = '200',65 )66 integrationResponse = apigwClient.put_integration_response(67 restApiId = apigwId,68 resourceId = item['id'],69 httpMethod = "OPTIONS",70 statusCode = '200',71 responseParameters = {72 "method.response.header.Access-Control-Allow-Origin": "'*'",73 "method.response.header.Access-Control-Allow-Methods": "'GET,OPTIONS'",74 "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",75 }76 )77 except Exception as e:78 pprint(e.message)79 if item['path'] == "/symbols":80 try:81 methodResponse = apigwClient.put_method_response(82 restApiId = apigwId,83 resourceId = item['id'],84 httpMethod = "OPTIONS",85 statusCode = '200',86 responseParameters = methodResponses87 )88 except apigwClient.exceptions.ConflictException as e:89 methodResponse = apigwClient.delete_method_response(90 restApiId = apigwId,91 resourceId = item['id'],92 httpMethod = "OPTIONS",93 statusCode = '200',94 )95 methodResponse = apigwClient.put_method_response(96 restApiId = apigwId,97 resourceId = item['id'],98 httpMethod = "OPTIONS",99 statusCode = '200',100 responseParameters = methodResponses101 )102 except Exception as e:103 pprint(e.message)104 try:105 integrationResponse = apigwClient.put_integration_response(106 restApiId = apigwId,107 resourceId = item['id'],108 httpMethod = "OPTIONS",109 statusCode = '200',110 responseParameters = {111 "method.response.header.Access-Control-Allow-Origin": "'*'",112 "method.response.header.Access-Control-Allow-Methods": "'POST,OPTIONS'",113 "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",114 }115 )116 except apigwClient.exceptions.ConflictException as e:117 integrationResponse = apigwClient.delete_integration_response(118 restApiId = apigwId,119 resourceId = item['id'],120 httpMethod = "OPTIONS",121 statusCode = '200',122 )123 integrationResponse = apigwClient.put_integration_response(124 restApiId = apigwId,125 resourceId = item['id'],126 httpMethod = "OPTIONS",127 statusCode = '200',128 responseParameters = {129 "method.response.header.Access-Control-Allow-Origin": "'*'",130 "method.response.header.Access-Control-Allow-Methods": "'POST,OPTIONS'",131 "method.response.header.Access-Control-Allow-Headers": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'",...
test_generator.py
Source: test_generator.py
1from pyboto3 import interface_generator2import json3def test_get_services_dir():4 assert interface_generator.get_services_dir()5 service_json_path_dict = dict(interface_generator.iter_services_json_paths())6 for service_name, json_path in service_json_path_dict.iteritems():7 print service_name, json_path8 apigateway_methods = {'can_paginate', 'create_api_key', 'create_authorizer', 'create_base_path_mapping',9 'create_deployment',10 'create_domain_name', 'create_model', 'create_resource', 'create_rest_api', 'create_stage',11 'delete_api_key', 'delete_authorizer', 'delete_base_path_mapping',12 'delete_client_certificate',13 'delete_deployment', 'delete_domain_name', 'delete_integration',14 'delete_integration_response',15 'delete_method', 'delete_method_response', 'delete_model', 'delete_resource',16 'delete_rest_api',17 'delete_stage', 'flush_stage_authorizers_cache', 'flush_stage_cache',18 'generate_client_certificate',19 'generate_presigned_url', 'get_account', 'get_api_key', 'get_api_keys', 'get_authorizer',20 'get_authorizers', 'get_base_path_mapping', 'get_base_path_mappings',21 'get_client_certificate',22 'get_client_certificates', 'get_deployment', 'get_deployments', 'get_domain_name',23 'get_domain_names',24 'get_export', 'get_integration', 'get_integration_response', 'get_method',25 'get_method_response',26 'get_model', 'get_model_template', 'get_models', 'get_paginator', 'get_resource',27 'get_resources',28 'get_rest_api', 'get_rest_apis', 'get_sdk', 'get_stage', 'get_stages', 'get_waiter',29 'import_rest_api',30 'put_integration', 'put_integration_response', 'put_method', 'put_method_response',31 'put_rest_api',32 'test_invoke_authorizer', 'test_invoke_method', 'update_account', 'update_api_key',33 'update_authorizer',34 'update_base_path_mapping', 'update_client_certificate', 'update_deployment',35 'update_domain_name',36 'update_integration', 'update_integration_response', 'update_method',37 'update_method_response',38 'update_model', 'update_resource', 'update_rest_api', 'update_stage'}39 apigateway_dict = json.load(open(service_json_path_dict.get('apigateway')))40 assert set(interface_generator.iter_method_names(apigateway_dict)) == apigateway_methods41 s3_methods = {'abort_multipart_upload', 'can_paginate', 'complete_multipart_upload', 'copy_object',42 'create_bucket',43 'create_multipart_upload', 'delete_bucket', 'delete_bucket_cors', 'delete_bucket_lifecycle',44 'delete_bucket_policy', 'delete_bucket_replication', 'delete_bucket_tagging',45 'delete_bucket_website',46 'delete_object', 'delete_objects', 'download_file', 'generate_presigned_post',47 'generate_presigned_url', 'get_bucket_accelerate_configuration', 'get_bucket_acl',48 'get_bucket_cors',49 'get_bucket_lifecycle', 'get_bucket_lifecycle_configuration', 'get_bucket_location',50 'get_bucket_logging', 'get_bucket_notification', 'get_bucket_notification_configuration',51 'get_bucket_policy', 'get_bucket_replication', 'get_bucket_request_payment', 'get_bucket_tagging',52 'get_bucket_versioning', 'get_bucket_website', 'get_object', 'get_object_acl',53 'get_object_torrent',54 'get_paginator', 'get_waiter', 'head_bucket', 'head_object', 'list_buckets',55 'list_multipart_uploads',56 'list_object_versions', 'list_objects', 'list_objects_v2', 'list_parts',57 'put_bucket_accelerate_configuration', 'put_bucket_acl', 'put_bucket_cors',58 'put_bucket_lifecycle',59 'put_bucket_lifecycle_configuration', 'put_bucket_logging', 'put_bucket_notification',60 'put_bucket_notification_configuration', 'put_bucket_policy', 'put_bucket_replication',61 'put_bucket_request_payment', 'put_bucket_tagging', 'put_bucket_versioning', 'put_bucket_website',62 'put_object', 'put_object_acl', 'restore_object', 'upload_file', 'upload_part',63 'upload_part_copy'}64 s3_dict = json.load(open(service_json_path_dict.get('s3')))...
integration_response.py
Source: integration_response.py
1# Copyright 2015 Isotoma Limited2#3# Licensed under the Apache License, Version 2.0 (the "License");4# you may not use this file except in compliance with the License.5# You may obtain a copy of the License at6#7# http://www.apache.org/licenses/LICENSE-2.08#9# Unless required by applicable law or agreed to in writing, software10# distributed under the License is distributed on an "AS IS" BASIS,11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12# See the License for the specific language governing permissions and13# limitations under the License.14from touchdown.core import argument, resource, serializers15from touchdown.core.plan import Plan16from ..common import SimpleApply, SimpleDescribe, SimpleDestroy17from .resource import Resource18class IntegrationResponse(resource.Resource):19 resource_name = "integration_response"20 name = argument.String(field="httpMethod")21 status_code = argument.String(field="statusCode")22 selection_pattern = argument.String(field="selectionPattern")23 response_parameters = argument.Dict(field="responseParameters")24 response_templates = argument.Dict(field="responseTemplates")25 resource = argument.Resource(Resource, field="resourceId")26class Describe(SimpleDescribe, Plan):27 resource = IntegrationResponse28 service_name = "apigateway"29 api_version = "2015-07-09"30 describe_action = "get_integration_response"31 describe_notfound_exception = "NotFoundException"32 describe_envelope = "[@]"33 key = "httpMethod"34 def get_describe_filters(self):35 api = self.runner.get_plan(self.resource.resource.api)36 if not api.resource_id:37 return None38 resource = self.runner.get_plan(self.resource.resource)39 if not resource.resource_id:40 return None41 return {42 "restApiId": api.resource_id,43 "resourceId": resource.resource_id,44 "httpMethod": self.resource.name,45 "statusCode": self.resource.status_code,46 }47class Apply(SimpleApply, Describe):48 create_action = "put_integration_response"49 create_envelope = "@"50 def get_create_serializer(self):51 return serializers.Resource(restApiId=self.resource.resource.api.identifier())52class Destroy(SimpleDestroy, Describe):53 destroy_action = "delete_integration_response"54 def get_destroy_serializer(self):55 return serializers.Dict(56 restApiId=self.resource.resource.api.identifier(),57 resourceId=self.resource.identifier(),...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!