Best Python code snippet using tempest_python
test_volume_metadata.py
Source:test_volume_metadata.py
...35 "key4": "<value&special_chars>"}36 body = self.volumes_client.create_volume_metadata(self.volume_id,37 metadata)['metadata']38 # Get the metadata of the volume39 body = self.volumes_client.show_volume_metadata(40 self.volume_id)['metadata']41 self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))42 # Delete one item metadata of the volume43 self.volumes_client.delete_volume_metadata_item(44 self.volume_id, "key1")45 body = self.volumes_client.show_volume_metadata(46 self.volume_id)['metadata']47 self.assertNotIn("key1", body)48 del metadata["key1"]49 self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))50 @test.idempotent_id('774d2918-9beb-4f30-b3d1-2a4e8179ec0a')51 def test_update_volume_metadata(self):52 # Update metadata for the volume53 metadata = {"key1": "value1",54 "key2": "value2",55 "key3": "value3"}56 update = {"key4": "value4",57 "key1": "value1_update"}58 # Create metadata for the volume59 body = self.volumes_client.create_volume_metadata(60 self.volume_id, metadata)['metadata']61 # Get the metadata of the volume62 body = self.volumes_client.show_volume_metadata(63 self.volume_id)['metadata']64 self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))65 # Update metadata66 body = self.volumes_client.update_volume_metadata(67 self.volume_id, update)['metadata']68 # Get the metadata of the volume69 body = self.volumes_client.show_volume_metadata(70 self.volume_id)['metadata']71 self.assertEqual(update, body)72 @test.idempotent_id('862261c5-8df4-475a-8c21-946e50e36a20')73 def test_update_volume_metadata_item(self):74 # Update metadata item for the volume75 metadata = {"key1": "value1",76 "key2": "value2",77 "key3": "value3"}78 update_item = {"key3": "value3_update"}79 expect = {"key1": "value1",80 "key2": "value2",81 "key3": "value3_update"}82 # Create metadata for the volume83 body = self.volumes_client.create_volume_metadata(84 self.volume_id, metadata)['metadata']85 self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))86 # Update metadata item87 body = self.volumes_client.update_volume_metadata_item(88 self.volume_id, "key3", update_item)['meta']89 # Get the metadata of the volume90 body = self.volumes_client.show_volume_metadata(91 self.volume_id)['metadata']92 self.assertThat(body.items(), matchers.ContainsAll(expect.items()))93class VolumesV1MetadataTest(VolumesV2MetadataTest):...
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!!