Best Python code snippet using tempest_python
test_waiters.py
Source:test_waiters.py
...79 'stores': 'fake_store'})80 self.assertRaises(lib_exc.TimeoutException,81 waiters.wait_for_image_imported_to_stores,82 client, 'fake_image_id', 'fake_store')83 def test_wait_for_image_copied_to_stores(self):84 self.client.show_image.return_value = ({85 'status': 'active',86 'os_glance_importing_to_stores': '',87 'os_glance_failed_import': 'fake_os_glance_failed_import'})88 start_time = int(time.time())89 waiters.wait_for_image_copied_to_stores(90 self.client, 'fake_image_id')91 end_time = int(time.time())92 # Ensure waiter returns before build_timeout93 self.assertLess((end_time - start_time), 10)94 def test_wait_for_image_copied_to_stores_timeout(self):95 time_mock = self.patch('time.time')96 self.patch('time.time', side_effect=[0., 1.])97 time_mock.side_effect = utils.generate_timeout_series(1)98 self.client.show_image.return_value = ({99 'status': 'active',100 'os_glance_importing_to_stores': 'processing',101 'os_glance_failed_import': 'fake_os_glance_failed_import'})102 self.assertRaises(lib_exc.TimeoutException,103 waiters.wait_for_image_copied_to_stores,...
manager.py
Source:manager.py
...110 self.image_client.image_import(image['id'],111 method='copy-image',112 all_stores=True,113 all_stores_must_succeed=False)114 failed_stores = waiters.wait_for_image_copied_to_stores(115 self.image_client, image['id'])116 self.assertEqual(0, len(failed_stores),117 "Failed to copy the following stores: %s" %118 str(failed_stores))119 return image['id']120 def create_floating_ip(self, thing, pool_name=None):121 """Create a floating IP and associates to a server on Nova"""122 if not pool_name:123 pool_name = CONF.network.floating_network_name124 floating_ip = (self.compute_floating_ips_client.125 create_floating_ip(pool=pool_name)['floating_ip'])126 self.addCleanup(test_utils.call_and_ignore_notfound_exc,127 self.compute_floating_ips_client.delete_floating_ip,128 floating_ip['id'])...
test_images.py
Source:test_images.py
...95 self.admin_client.image_import(image['id'], method='copy-image',96 all_stores=True,97 all_stores_must_succeed=False)98 # Wait for copy to finished on all stores.99 failed_stores = waiters.wait_for_image_copied_to_stores(100 self.client, image['id'])101 # Assert if copy is failed on any store.102 self.assertEqual(0, len(failed_stores),103 "Failed to copy the following stores: %s" %...
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!!