Best Python code snippet using tempest_python
shares_client.py
Source:shares_client.py
...311 if rule["id"] == rule_id:312 return False313 return True314 else:315 return self._is_resource_deleted(316 self.get_share, kwargs.get("share_id"))317 elif "snapshot_id" in kwargs:318 return self._is_resource_deleted(319 self.get_snapshot, kwargs.get("snapshot_id"))320 elif "sn_id" in kwargs:321 return self._is_resource_deleted(322 self.get_share_network, kwargs.get("sn_id"))323 elif "ss_id" in kwargs:324 return self._is_resource_deleted(325 self.get_security_service, kwargs.get("ss_id"))326 elif "vt_id" in kwargs:327 return self._is_resource_deleted(328 self.get_volume_type, kwargs.get("vt_id"))329 elif "st_id" in kwargs:330 return self._is_resource_deleted(331 self.get_share_type, kwargs.get("st_id"))332 elif "server_id" in kwargs:333 return self._is_resource_deleted(334 self.show_share_server, kwargs.get("server_id"))335 else:336 raise share_exceptions.InvalidResource(337 message=six.text_type(kwargs))338 def _is_resource_deleted(self, func, res_id):339 try:340 res = func(res_id)341 except exceptions.NotFound:342 return True343 if res.get('status') in ['error_deleting', 'error']:344 # Resource has "error_deleting" status and can not be deleted.345 resource_type = func.__name__.split('_', 1)[-1]346 raise share_exceptions.ResourceReleaseFailed(347 res_type=resource_type, res_id=res_id)348 return False349 def wait_for_resource_deletion(self, *args, **kwargs):350 """Waits for a resource to be deleted."""351 start_time = int(time.time())352 while True:...
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!!