Best Python code snippet using tempest_python
test_images_oneserver.py
Source:test_images_oneserver.py
...34 raise cls.skipException(skip_msg)35 @classmethod36 def setup_clients(cls):37 super(ImagesOneServerTestJSON, cls).setup_clients()38 if cls.is_requested_microversion_compatible('2.35'):39 cls.client = cls.compute_images_client40 else:41 cls.client = cls.images_client42 def _get_default_flavor_disk_size(self, flavor_id):43 flavor = self.flavors_client.show_flavor(flavor_id)['flavor']44 return flavor['disk']45 @decorators.idempotent_id('3731d080-d4c5-4872-b41a-64d0d0021314')46 def test_create_delete_image(self):47 if self.is_requested_microversion_compatible('2.35'):48 MIN_DISK = 'minDisk'49 MIN_RAM = 'minRam'50 else:51 MIN_DISK = 'min_disk'52 MIN_RAM = 'min_ram'53 # Create a new image54 name = data_utils.rand_name('image')55 meta = {'image_type': 'test'}56 image = self.create_image_from_server(self.server_id, name=name,57 metadata=meta,58 wait_until='ACTIVE')59 # Verify the image was created correctly60 self.assertEqual(name, image['name'])61 if self.is_requested_microversion_compatible('2.35'):62 self.assertEqual('test', image['metadata']['image_type'])63 else:64 self.assertEqual('test', image['image_type'])65 original_image = self.client.show_image(self.image_ref)66 if self.is_requested_microversion_compatible('2.35'):67 original_image = original_image['image']68 # Verify minRAM is the same as the original image69 self.assertEqual(image[MIN_RAM], original_image[MIN_RAM])70 # Verify minDisk is the same as the original image or the flavor size71 flavor_disk_size = self._get_default_flavor_disk_size(self.flavor_ref)72 self.assertIn(str(image[MIN_DISK]),73 (str(original_image[MIN_DISK]), str(flavor_disk_size)))74 # Verify the image was deleted correctly75 self.client.delete_image(image['id'])76 self.client.wait_for_resource_deletion(image['id'])77 @decorators.idempotent_id('3b7c6fe4-dfe7-477c-9243-b06359db51e6')78 def test_create_image_specify_multibyte_character_image_name(self):79 # prefix character is:80 # http://unicode.org/cldr/utility/character.jsp?a=20A1...
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!!