Best Python code snippet using localstack_python
test_configservice.py
Source:test_configservice.py
...47 barrel = ConfigServiceBarrel({}, clients=clients)48 tap_return = barrel.tap('describe_configuration_recorders')49 expected_return = barrel.describe_configuration_recorders()50 self.assertEqual(expected_return, tap_return)51 def test_tap_functions_with_describe_configuration_recorder_status(self):52 fixture = {53 'ConfigurationRecordersStatus': [54 {55 'name': 'A Recorder',56 }57 ]58 }59 clients = {60 'us-east-1': self.client_mock(fixture)61 }62 barrel = ConfigServiceBarrel({}, clients=clients)63 tap_return = barrel.tap('describe_configuration_recorder_status')64 expected_return = barrel.describe_configuration_recorder_status()65 self.assertEqual(expected_return, tap_return)66 def test_tap_throws_error_with_unsupported_call(self):67 barrel = ConfigServiceBarrel({})68 with self.assertRaises(RuntimeError):69 barrel.tap('unsupported_call')70 def test_describe_configuration_recorders_lists_by_region(self):71 fixture_1 = {72 'ConfigurationRecorders': [73 {74 'name': 'A Recorder',75 },76 {77 'name': 'A Recorder 2',78 }79 ]80 }81 fixture_2 = {82 'ConfigurationRecorders': [83 {84 'name': 'A Recorder 3',85 },86 {87 'name': 'A Recorder 4',88 }89 ]90 }91 clients = {92 'us-east-1': self.client_mock(fixture_1),93 'us-east-2': self.client_mock(fixture_2),94 }95 barrel = ConfigServiceBarrel({}, clients=clients)96 results = barrel.describe_configuration_recorders()97 expected = {98 'us-east-1': [99 {100 'name': 'A Recorder'101 },102 {103 'name': 'A Recorder 2'104 },105 ],106 'us-east-2': [107 {108 'name': 'A Recorder 3'109 },110 {111 'name': 'A Recorder 4'112 },113 ]114 }115 self.assertEqual(results, expected)116 def test_describe_configuration_recorders_empty(self):117 fixture = {118 'ConfigurationRecorders': []119 }120 clients = {121 'us-east-1': self.client_mock(fixture)122 }123 barrel = ConfigServiceBarrel({}, clients=clients)124 results = barrel.describe_configuration_recorders()125 expected = {126 'us-east-1': []127 }128 self.assertEqual(results, expected)129 def test_describe_configuration_recorder_status_lists_by_region(self):130 fixture_1 = {131 'ConfigurationRecordersStatus': [132 {133 'name': 'A Recorder',134 },135 {136 'name': 'A Recorder 2',137 }138 ]139 }140 fixture_2 = {141 'ConfigurationRecordersStatus': [142 {143 'name': 'A Recorder 3',144 },145 {146 'name': 'A Recorder 4',147 }148 ]149 }150 clients = {151 'us-east-1': self.client_mock(fixture_1),152 'us-east-2': self.client_mock(fixture_2),153 }154 barrel = ConfigServiceBarrel({}, clients=clients)155 results = barrel.describe_configuration_recorder_status()156 expected = {157 'us-east-1': [158 {159 'name': 'A Recorder'160 },161 {162 'name': 'A Recorder 2'163 },164 ],165 'us-east-2': [166 {167 'name': 'A Recorder 3'168 },169 {170 'name': 'A Recorder 4'171 },172 ]173 }174 self.assertEqual(results, expected)175 def test_describe_configuration_recorder_status_empty(self):176 fixture = {177 'ConfigurationRecordersStatus': []178 }179 clients = {180 'us-east-1': self.client_mock(fixture)181 }182 barrel = ConfigServiceBarrel({}, clients=clients)183 results = barrel.describe_configuration_recorder_status()184 expected = {185 'us-east-1': []186 }...
responses.py
Source:responses.py
...11 def describe_configuration_recorders(self):12 recorders = self.config_backend.describe_configuration_recorders(self._get_param('ConfigurationRecorderNames'))13 schema = {'ConfigurationRecorders': recorders}14 return json.dumps(schema)15 def describe_configuration_recorder_status(self):16 recorder_statuses = self.config_backend.describe_configuration_recorder_status(17 self._get_param('ConfigurationRecorderNames'))18 schema = {'ConfigurationRecordersStatus': recorder_statuses}19 return json.dumps(schema)20 def put_delivery_channel(self):21 self.config_backend.put_delivery_channel(self._get_param('DeliveryChannel'))22 return ""23 def describe_delivery_channels(self):24 delivery_channels = self.config_backend.describe_delivery_channels(self._get_param('DeliveryChannelNames'))25 schema = {'DeliveryChannels': delivery_channels}26 return json.dumps(schema)27 def describe_delivery_channel_status(self):28 raise NotImplementedError()29 def delete_delivery_channel(self):30 self.config_backend.delete_delivery_channel(self._get_param('DeliveryChannelName'))...
configservice.py
Source:configservice.py
...45 response = self.clients[region].describe_configuration_recorders()46 recorders = response.get('ConfigurationRecorders', [])47 recorders_by_region[region] = recorders48 return recorders_by_region49 def describe_configuration_recorder_status(self):50 recorders_status_by_region = {}51 for region, client in self.clients.items():52 response = self.clients[region].describe_configuration_recorder_status()53 recorders_status = response.get('ConfigurationRecordersStatus', [])54 recorders_status_by_region[region] = recorders_status...
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!!