Best Python code snippet using localstack_python
test_elb.py
Source:test_elb.py
...89 cls._boto3_connection_kwargs = {'foo': 'bar', 'baz': 'blam'}90 cls.get_limits()91 cls._update_limits_from_api()92 assert mock_connect.mock_calls == [call()]93 assert mock_conn.mock_calls == [call.describe_account_limits()]94 assert mock_client.mock_calls == [95 call('elbv2', foo='bar', baz='blam'),96 call().describe_account_limits()97 ]98 assert cls.limits['Active load balancers'].api_limit == 399 assert cls.limits['Listeners per load balancer'].api_limit == 5100 assert cls.limits['Target groups'].api_limit == 7101 assert cls.limits[102 'Listeners per application load balancer'].api_limit == 9103 assert cls.limits['Rules per application load balancer'].api_limit == 10104 def test_find_usage(self):105 with patch('%s._find_usage_elbv1' % pb, autospec=True) as mock_v1:106 with patch('%s._find_usage_elbv2' % pb, autospec=True) as mock_v2:107 mock_v1.return_value = 3108 mock_v2.return_value = 5109 cls = _ElbService(21, 43)110 assert cls._have_usage is False...
not_used_operations.py
Source:not_used_operations.py
1not_used_operations = {2 'ec2': [3 'describe_load_balancer_policies',4 'describe_vpc_endpoint_services',5 'describe_aggregate_id_format',6 'describe_load_balancer_policy_types',7 'describe_endpoints',8 'describe_availability_zones',9 'describe_account_attributes',10 'describe_dhcp_options',11 'describe_fpga_images',12 'describe_host_reservation_offerings',13 'describe_id_format',14 'describe_instance_event_notification_attributes',15 'describe_instance_type_offerings',16 'describe_instance_types',17 'describe_managed_prefix_lists',18 'describe_prefix_lists',19 'describe_regions',20 'describe_launch_template_versions',21 'describe_principal_id_format',22 'describe_spot_price_history',23 'describe_flow_logs',24 ### The blow 2 require extra parameters.25 'describe_images',26 'describe_snapshots',27 ],28 'ecr': [29 'get_authorization_token',30 ],31 'ecs': [32 'describe_capacity_providers',33 ],34 'efs': [35 'describe_account_preferences',36 ],37 'acm': [38 'get_account_configuration',39 ],40 'athena': [41 'list_data_catalogs',42 ],43 'apigateway': [44 'get_account',45 'get_sdk_types',46 ],47 'xray': [48 'get_encryption_config',49 'get_sample_rules',50 ],51 'waf': [52 'get_change_token',53 ],54 'waf-regional': [55 'get_change_token',56 ],57 'sts': [58 'get_caller_identity',59 'get_session_token',60 ],61 'ssm': [62 'describe_available_patches',63 'describe_patch_baselines',64 'get_inventory_schema',65 ],66 'ses': [67 'get_account_sending_enabled',68 'get_send_quota',69 ],70 'sesv2': [71 'get_account',72 'get_deliverability_dashboard_options',73 ],74 'signer': [75 'list_signing_platforms',76 ],77 'shield': [78 'describe_attack_statistics',79 'get_subscription_state',80 ],81 'lex-models': [82 'get_builtin_intents',83 'get_builtin_slot_types',84 ],85 'dynamodb': [86 'describe_limits',87 ],88 'lightsail': [89 'get_blueprints',90 'get_container_service_powers',91 'get_container_api_metadata',92 'get_bundles',93 'get_relational_database_blueprints',94 'get_relational_database_bundles',95 'get_regions',96 'get_bucket_bundles',97 ],98 'inspector': [99 'describe_cross_account_access_role',100 'list_rules_packages',101 ],102 'lambda': [103 'get_account_settings',104 ],105 'kinesis': [106 'describe_limits',107 ],108 'kafka': [109 'list_kafka_versions',110 'get_compatible_kafka_versions',111 ],112 'iot': [113 'describe_account_audit_configuration',114 'describe_event_configurations',115 'get_indexing_configuration',116 'get_registration_code',117 'list_domain_configurations'118 ],119 'iotsitewise': [120 'describe_logging_options',121 'describe_storage_configuration'122 ],123 'guardduty': [124 'get_invitations_count',125 ],126 'gamelift': [127 'describe_ec2_instance_limits',128 ],129 'elb': [130 'describe_account_limits',131 'describe_load_balancer_policies',132 ],133 'elbv2': [134 'describe_account_limits',135 'describe_ssl_policies',136 ],137 'elasticache': [138 'describe_cache_parameter_groups',139 'describe_service_updates',140 'list_allowed_node_type_modifications',141 'describe_cache_security_groups',142 'describe_users',143 ],144 'elasticbeanstalk': [145 'describe_account_attributes',146 'list_available_solution_stacks'147 ],148 'clouddirectory': [149 'list_managed_schema_arns',150 ],151 'codebuild': [152 'list_builds',153 'list_curated_environment_images'154 ],155 'cloudtrail': [156 'list_public_keys',157 'get_event_selectors',158 ],159 'cloudwatch': [160 'describe_alarm_history',161 'list_metrics',162 ],163 'snowball': [164 'get_snowball_usage',165 'list_compatible_images'166 ],167 'sms': [168 'get_servers'169 ],170 'sagemaker': [171 'get_sagemaker_servicecatalog_portfolio_status',172 ],173 'transfer': [174 'list_security_policies'175 ],176 'schemas': [177 'list_registries',178 ],179 'securityhub': [180 'describe_standards',181 ],182 'secretsmanager': [183 'get_random_password',184 ],185 'service-quotes': [186 'list_services',187 ],188 'wellarchitected': [189 'list_lenses',190 ],191 'route53': [192 'get_checker_ip_ranges',193 'get_geo_location',194 'get_traffic_policy_instance_count',195 'get_hosted_zone_count',196 'get_health_check_count',197 'list_geo_locations',198 ],199 'resourcegroupstaggingapi': [200 'get_resources',201 'get_tag_keys',202 ],203 'events': [204 'describe_event_bus',205 'list_event_buses',206 ],207 'fis': [208 'list_actions',209 ],210 'frauddetector': [211 'get_kms_encryption_key',212 ],213 'glacier': [214 'get_data_retrieval_policy',215 ],216 'glue': [217 'get_catalog_import_status',218 ],219 'apprunner': [220 'list_auto_scaling_configurations',221 ],222 'rds': [223 'describe_account_attributes',224 'describe_certificates',225 'describe_source_regions',226 ],227 'ram': [228 'list_permissions',229 ],230 'redshift': [231 'describe_account_attributes',232 'describe_cluster_tracks',233 'describe_orderable_cluster_options',234 'describe_storage',235 ],236 'polly': [237 'describe_voices',238 ],239 'opsworks': [240 'describe_my_user_profile',241 'describe_operating_systems',242 'describe_user_profiles',243 ],244 'opsworkscm': [245 'describe_account_attributes',246 ],247 'emr': [248 'get_block_public_access_configuration',249 'list_release_labels',250 ],251 'elastictranscoder': [252 'list_presets',253 ],254 'dms': [255 'describe_account_attributes',256 'describe_applicable_individual_assessments',257 'describe_orderable_replication_instances',258 ],259 'docdb': [260 'describe_certificates',261 'describe_db_subnet_groups',262 ],263 'ds': [264 'get_directory_limits',265 ],266 'compute-optimizer': [267 'get_enrollment_status',268 ],269 'config': [270 'get_compliance_summary_by_config_rule',271 'get_compliance_summary_by_resource_type',272 'get_discovered_resource_counts',273 ],274 'dax': [275 'describe_parameter_groups'276 ],277 'codedeploy': [278 'list_deployment_configs',279 ],280 'backup': [281 'list_backup_plan_templates',282 ],283 'autoscaling': [284 'describe_account_limits',285 ],286 'auditmanger': [287 'get_account_status',288 ],289 'cloudformation': [290 'describe_account_limits',291 ],292 'nimble': [293 'list_eulas',294 ],295 'cloudfront': [296 'list_cache_polocies',297 ]...
__init__.py
Source:__init__.py
...25 Returns a dict containing the limits and current usage26 """27 response = {}28 c = self.connect("autoscaling")29 limits = c.describe_account_limits()30 return self.parse_response(limits, ASG_INTERESTING_KEYS)31 def get_ec2_limits(self):32 """33 Queries AWS to get a dict containing the account attributes34 returns: dict35 """36 c = self.connect("ec2")37 limits = c.describe_account_attributes()38 result = {}39 for account_attribute in limits["AccountAttributes"]:40 try:41 result[account_attribute["AttributeName"]] = account_attribute["AttributeValues"][0]["AttributeValue"]42 except (IndexError, KeyError) as e:43 return None...
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!!