Best Python code snippet using localstack_python
aws_logs_info.py
Source:aws_logs_info.py
...155 return paginator.paginate(156 logGroupName=module.params['name']157 ), True158 else:159 return client.describe_metric_filters(160 logGroupName=module.params['name']161 ), False162 elif module.params['describe_queries']:163 if client.can_paginate('describe_queries'):164 paginator = client.get_paginator('describe_queries')165 return paginator.paginate(166 logGroupName=module.params['name'],167 status=module.params['query_status']168 ), True169 else:170 return client.describe_queries(171 logGroupName=module.params['name'],172 status=module.params['query_status']173 ), False...
test_cloudwatchlogs.py
Source:test_cloudwatchlogs.py
...34 'sa-east-1',35 ])36 barrel = CloudWatchLogsBarrel({}, clients={})37 self.assertEqual(supported_regions, barrel.supported_regions)38 def test_tap_functions_with_describe_metric_filters(self):39 fixture = [40 {41 'metricFilters': [42 {43 'filterName': 'a_trail',44 }45 ]46 }47 ]48 clients = {49 'us-east-1': self.client_mock(fixture)50 }51 barrel = CloudWatchLogsBarrel({}, clients=clients)52 tap_return = barrel.tap('describe_metric_filters')53 describe_metric_filters_return = barrel.describe_metric_filters()54 self.assertEqual(describe_metric_filters_return, tap_return)55 def test_tap_throws_error_with_unsupported_call(self):56 barrel = CloudWatchLogsBarrel({})57 with self.assertRaises(RuntimeError):58 barrel.tap('unsupported_call')59 def test_describe_metric_filters_returns_filters_by_region(self):60 fixture_1 = [61 {62 'metricFilters': [63 {64 'filterName': 'a_filter',65 }66 ]67 },68 {69 'metricFilters': [70 {71 'filterName': 'another_filter',72 }73 ]74 }75 ]76 fixture_2 = [77 {78 'metricFilters': [79 {80 'filterName': 'another_other_filter',81 }82 ]83 },84 {85 'metricFilters': [86 {87 'filterName': 'another_other_other_filter',88 }89 ]90 }91 ]92 clients = {93 'us-east-1': self.client_mock(fixture_1),94 'us-east-2': self.client_mock(fixture_2),95 }96 barrel = CloudWatchLogsBarrel({}, clients=clients)97 results = barrel.describe_metric_filters()98 expected = {99 'us-east-1': [100 {101 'filterName': 'a_filter'102 },103 {104 'filterName': 'another_filter'105 },106 ],107 'us-east-2': [108 {109 'filterName': 'another_other_filter'110 },111 {112 'filterName': 'another_other_other_filter'113 },114 ]115 }116 self.assertEqual(results, expected)117 def test_describe_metric_filters_empty(self):118 fixture = [119 {120 'metricFilters': []121 }122 ]123 clients = {124 'us-east-1': self.client_mock(fixture)125 }126 barrel = CloudWatchLogsBarrel({}, clients=clients)127 results = barrel.describe_metric_filters()128 expected = {129 'us-east-1': []130 }...
cloudwatchlogs.py
Source:cloudwatchlogs.py
...37 'logs',38 region_name=region,39 )40 return clients41 def describe_metric_filters(self):42 filters_by_region = {}43 for region, client in self.clients.items():44 paginator = self.clients[region].get_paginator(45 'describe_metric_filters',46 )47 response_iterator = paginator.paginate()48 filters = []49 for page in response_iterator:50 filters.extend(page['metricFilters'])51 filters_by_region[region] = filters...
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!!