Best Python code snippet using tempest_python
snapshots_client.py
Source:snapshots_client.py
...140 resp, body = self.put(url, put_body)141 body = json.loads(body)142 self.validate_response(schema.update_snapshot_metadata, resp, body)143 return rest_client.ResponseBody(resp, body)144 def show_snapshot_metadata_item(self, snapshot_id, id):145 """Show metadata item for the snapshot."""146 url = "snapshots/%s/metadata/%s" % (snapshot_id, id)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)...
test_snapshots_metadata_rbac.py
Source:test_snapshots_metadata_rbac.py
...71 self.snapshot['id'], metadata=update)72 @decorators.idempotent_id('93068d02-0131-4dd3-af16-fc40d7128d93')73 @rbac_rule_validation.action(service="cinder",74 rules=["volume:get_snapshot_metadata"])75 def test_show_snapshot_metadata_item(self):76 self._create_test_snapshot_metadata()77 with self.override_role():78 self.snapshots_client.show_snapshot_metadata_item(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):...
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!!