Best Python code snippet using localstack_python
servicemanagement_test.py
Source:servicemanagement_test.py
...42 """Verify rate limiter is None if the configuration is missing."""43 sm_api_client = servicemanagement.ServiceManagementClient(44 global_configs={})45 self.assertEqual(None, sm_api_client.repository._rate_limiter)46 def test_get_enabled_apis(self):47 """Tests that get_enabled_apis returns expected number of results."""48 mock_responses = []49 for page in fake_sm.LIST_CONSUMER_SERVICES_RESPONSES:50 mock_responses.append(({'status': '200'}, page))51 http_mocks.mock_http_response_sequence(mock_responses)52 return_value = self.sm_api_client.get_enabled_apis(53 fake_sm.FAKE_PROJECT_ID)54 self.assertEquals(fake_sm.EXPECTED_CONSUMER_SERVICES_COUNT,55 len(return_value))56 def test_get_enabled_apis_raises(self):57 """Tests that get_enabled_apis raises exception for invalid input."""58 http_mocks.mock_http_response(fake_sm.LIST_PERMISSION_DENIED, '403')59 with self.assertRaises(api_errors.ApiExecutionError):60 self.sm_api_client.get_enabled_apis(fake_sm.FAKE_PROJECT_ID)61 def test_get_produced_apis(self):62 """Tests that get_produced_apis returns expected number of results."""63 mock_responses = []64 for page in fake_sm.LIST_PRODUCER_SERVICES_RESPONSES:65 mock_responses.append(({'status': '200'}, page))66 http_mocks.mock_http_response_sequence(mock_responses)67 return_value = self.sm_api_client.get_produced_apis(68 fake_sm.FAKE_PROJECT_ID)69 self.assertEquals(fake_sm.EXPECTED_PRODUCER_SERVICES_COUNT,70 len(return_value))71 def test_get_produced_apis_raises(self):72 """Tests that get_produced_apis raises exception for invalid input."""73 http_mocks.mock_http_response(fake_sm.LIST_PERMISSION_DENIED, '403')74 with self.assertRaises(api_errors.ApiExecutionError):...
serviceusage_test.py
Source:serviceusage_test.py
...41 def test_no_quota(self, mock_google_credential):42 """Verify rate limiter is None if the configuration is missing."""43 su_api_client = serviceusage.ServiceUsageClient(global_configs={})44 self.assertEqual(None, su_api_client.repository._rate_limiter)45 def test_get_enabled_apis(self):46 """Tests that get_enabled_apis returns expected number of results."""47 mock_responses = []48 for page in fake_su.LIST_SERVICES_RESPONSES:49 mock_responses.append(({'status': '200'}, page))50 http_mocks.mock_http_response_sequence(mock_responses)51 return_value = self.su_api_client.get_enabled_apis(52 fake_su.FAKE_PROJECT_ID)53 self.assertEqual(fake_su.EXPECTED_SERVICES_COUNT, len(return_value))54 def test_get_enabled_apis_raises(self):55 """Tests that get_enabled_apis raises exception for invalid input."""56 http_mocks.mock_http_response(fake_su.LIST_PERMISSION_DENIED, '403')57 with self.assertRaises(api_errors.ApiExecutionError):58 self.su_api_client.get_enabled_apis(fake_su.FAKE_PROJECT_ID)59if __name__ == '__main__':...
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!!