How to use update_snapshot_metadata_item method in tempest

Best Python code snippet using tempest_python

snapshots_client.py

Source:snapshots_client.py Github

copy

Full Screen

...147 resp, body = self.get(url)148 body = json.loads(body)149 self.validate_response(schema.show_snapshot_metadata_item, resp, body)150 return rest_client.ResponseBody(resp, body)151 def update_snapshot_metadata_item(self, snapshot_id, id, **kwargs):152 """Update metadata for the snapshot for a specific key.153 For a full list of available parameters, please refer to the official154 API reference:155 https://docs.openstack.org/api-ref/block-storage/v3/#update-a-snapshot-s-metadata-for-a-specific-key156 """157 put_body = json.dumps(kwargs)158 url = "snapshots/%s/metadata/%s" % (snapshot_id, id)159 resp, body = self.put(url, put_body)160 body = json.loads(body)161 self.validate_response(162 schema.update_snapshot_metadata_item, resp, body)163 return rest_client.ResponseBody(resp, body)164 def delete_snapshot_metadata_item(self, snapshot_id, id):165 """Delete metadata item for the snapshot."""...

Full Screen

Full Screen

test_snapshot_metadata.py

Source:test_snapshot_metadata.py Github

copy

Full Screen

...82 body = self.client.show_snapshot_metadata(83 self.snapshot_id)['metadata']84 self.assertEqual(update, body)85 @test.idempotent_id('e8ff85c5-8f97-477f-806a-3ac364a949ed')86 def test_update_snapshot_metadata_item(self):87 # Update metadata item for the snapshot88 metadata = {"key1": "value1",89 "key2": "value2",90 "key3": "value3"}91 update_item = {"key3": "value3_update"}92 expect = {"key1": "value1",93 "key2": "value2",94 "key3": "value3_update"}95 # Create metadata for the snapshot96 body = self.client.create_snapshot_metadata(97 self.snapshot_id, metadata)['metadata']98 # Get the metadata of the snapshot99 body = self.client.show_snapshot_metadata(100 self.snapshot_id)['metadata']101 self.assertThat(body.items(), matchers.ContainsAll(metadata.items()))102 # Update metadata item103 body = self.client.update_snapshot_metadata_item(104 self.snapshot_id, "key3", meta=update_item)['meta']105 # Get the metadata of the snapshot106 body = self.client.show_snapshot_metadata(107 self.snapshot_id)['metadata']108 self.assertThat(body.items(), matchers.ContainsAll(expect.items()))109class SnapshotV1MetadataTestJSON(SnapshotV2MetadataTestJSON):...

Full Screen

Full Screen

test_snapshots_metadata_rbac.py

Source:test_snapshots_metadata_rbac.py Github

copy

Full Screen

...79 self.snapshot['id'], "key3")['meta']80 @decorators.idempotent_id('1f8f43e7-da31-4128-bb3c-73fc548650e3')81 @rbac_rule_validation.action(service="cinder",82 rules=["volume:update_snapshot_metadata"])83 def test_update_snapshot_metadata_item(self):84 update_item = {"key3": "value3_update"}85 self._create_test_snapshot_metadata()86 with self.override_role():87 self.snapshots_client.update_snapshot_metadata_item(88 self.snapshot['id'], "key3", meta=update_item)['meta']89 @decorators.idempotent_id('3ec32516-f7cd-4f88-b78a-ddee67492071')90 @rbac_rule_validation.action(service="cinder",91 rules=["volume:delete_snapshot_metadata"])92 def test_delete_snapshot_metadata_item(self):93 self._create_test_snapshot_metadata()94 with self.override_role():95 self.snapshots_client.delete_snapshot_metadata_item(...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful