Best Python code snippet using tempest_python
test_image.py
Source:test_image.py
...51 # get metadata52 image = self.conn.compute.get_image_metadata(image)53 self.assertFalse(image.metadata)54 # set no metadata55 self.conn.compute.set_image_metadata(image)56 image = self.conn.compute.get_image_metadata(image)57 self.assertFalse(image.metadata)58 # set empty metadata59 self.conn.compute.set_image_metadata(image, k0='')60 image = self.conn.compute.get_image_metadata(image)61 self.assertIn('k0', image.metadata)62 self.assertEqual('', image.metadata['k0'])63 # set metadata64 self.conn.compute.set_image_metadata(image, k1='v1')65 image = self.conn.compute.get_image_metadata(image)66 self.assertTrue(image.metadata)67 self.assertEqual(2, len(image.metadata))68 self.assertIn('k1', image.metadata)69 self.assertEqual('v1', image.metadata['k1'])70 # set more metadata71 self.conn.compute.set_image_metadata(image, k2='v2')72 image = self.conn.compute.get_image_metadata(image)73 self.assertTrue(image.metadata)74 self.assertEqual(3, len(image.metadata))75 self.assertIn('k1', image.metadata)76 self.assertEqual('v1', image.metadata['k1'])77 self.assertIn('k2', image.metadata)78 self.assertEqual('v2', image.metadata['k2'])79 # update metadata80 self.conn.compute.set_image_metadata(image, k1='v1.1')81 image = self.conn.compute.get_image_metadata(image)82 self.assertTrue(image.metadata)83 self.assertEqual(3, len(image.metadata))84 self.assertIn('k1', image.metadata)85 self.assertEqual('v1.1', image.metadata['k1'])86 self.assertIn('k2', image.metadata)87 self.assertEqual('v2', image.metadata['k2'])88 # delete metadata89 self.conn.compute.delete_image_metadata(image, image.metadata.keys())90 image = self.conn.compute.get_image_metadata(image)...
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!!