Best Python code snippet using tempest_python
test_snapshot_metadata.py
Source:test_snapshot_metadata.py  
...42                    "key3": "value3"}43        body = self.client.create_snapshot_metadata(self.snapshot_id,44                                                    metadata)45        # Get the metadata of the snapshot46        body = self.client.show_snapshot_metadata(self.snapshot_id)47        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))48        # Delete one item metadata of the snapshot49        self.client.delete_snapshot_metadata_item(50            self.snapshot_id, "key1")51        body = self.client.show_snapshot_metadata(self.snapshot_id)52        self.assertThat(body.items(), matchers.ContainsAll(expected.items()))53        self.assertNotIn("key1", body)54    @test.idempotent_id('bd2363bc-de92-48a4-bc98-28943c6e4be1')55    def test_update_snapshot_metadata(self):56        # Update metadata for the snapshot57        metadata = {"key1": "value1",58                    "key2": "value2",59                    "key3": "value3"}60        update = {"key3": "value3_update",61                  "key4": "value4"}62        # Create metadata for the snapshot63        body = self.client.create_snapshot_metadata(self.snapshot_id,64                                                    metadata)65        # Get the metadata of the snapshot66        body = self.client.show_snapshot_metadata(self.snapshot_id)67        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))68        # Update metadata item69        body = self.client.update_snapshot_metadata(70            self.snapshot_id, update)71        # Get the metadata of the snapshot72        body = self.client.show_snapshot_metadata(self.snapshot_id)73        self.assertEqual(update, body)74    @test.idempotent_id('e8ff85c5-8f97-477f-806a-3ac364a949ed')75    def test_update_snapshot_metadata_item(self):76        # Update metadata item for the snapshot77        metadata = {"key1": "value1",78                    "key2": "value2",79                    "key3": "value3"}80        update_item = {"key3": "value3_update"}81        expect = {"key1": "value1",82                  "key2": "value2",83                  "key3": "value3_update"}84        # Create metadata for the snapshot85        body = self.client.create_snapshot_metadata(self.snapshot_id,86                                                    metadata)87        # Get the metadata of the snapshot88        body = self.client.show_snapshot_metadata(self.snapshot_id)89        self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))90        # Update metadata item91        body = self.client.update_snapshot_metadata_item(92            self.snapshot_id, "key3", update_item)93        # Get the metadata of the snapshot94        body = self.client.show_snapshot_metadata(self.snapshot_id)95        self.assertThat(body.items(), matchers.ContainsAll(expect.items()))96class SnapshotV1MetadataTestJSON(SnapshotV2MetadataTestJSON):...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!!
