Best Python code snippet using tempest_python
test_volume_metadata_rbac.py
Source:test_volume_metadata_rbac.py
...92 @rbac_rule_validation.action(93 service="cinder",94 rules=[_METADATA_SET])95 def test_list_volumes_details_image_metadata(self):96 self.volumes_client.update_volume_image_metadata(97 self.volume['id'], image_id=self.image_id)98 self.addCleanup(self.volumes_client.delete_volume_image_metadata,99 self.volume['id'], 'image_id')100 with self.override_role():101 resp_body = self.volumes_client.list_volumes(detail=True)[102 'volumes']103 expected_attr = 'volume_image_metadata'104 if expected_attr not in resp_body[0]:105 raise rbac_exceptions.RbacMissingAttributeResponseBody(106 attribute=expected_attr)107 @decorators.idempotent_id('53f94d52-0dd5-42cf-a3a4-59b35150b3d5')108 @rbac_rule_validation.action(109 service="cinder",110 rules=[_METADATA_SHOW])111 def test_show_volume_details_image_metadata(self):112 self.volumes_client.update_volume_image_metadata(113 self.volume['id'], image_id=self.image_id)114 self.addCleanup(self.volumes_client.delete_volume_image_metadata,115 self.volume['id'], 'image_id')116 with self.override_role():117 resp_body = self.volumes_client.show_volume(self.volume['id'])[118 'volume']119 expected_attr = 'volume_image_metadata'120 if expected_attr not in resp_body:121 raise rbac_exceptions.RbacMissingAttributeResponseBody(122 attribute=expected_attr)123 @decorators.idempotent_id('a9d9e825-5ea3-42e6-96f3-7ac4e97b2ed0')124 @rbac_rule_validation.action(125 service="cinder",126 rules=[_METADATA_SET])127 def test_update_volume_image_metadata(self):128 with self.override_role():129 self.volumes_client.update_volume_image_metadata(130 self.volume['id'], image_id=self.image_id)131 self.addCleanup(self.volumes_client.delete_volume_image_metadata,132 self.volume['id'], 'image_id')133 @decorators.idempotent_id('a41c8eed-2051-4a25-b401-df036faacbdc')134 @rbac_rule_validation.action(135 service="cinder",136 rules=[_METADATA_REMOVE])137 def test_delete_volume_image_metadata(self):138 self.volumes_client.update_volume_image_metadata(139 self.volume['id'], image_id=self.image_id)140 self.addCleanup(test_utils.call_and_ignore_notfound_exc,141 self.volumes_client.delete_volume_image_metadata,142 self.volume['id'], 'image_id')143 with self.override_role():144 self.volumes_client.delete_volume_image_metadata(self.volume['id'],...
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!!