Best Python code snippet using tempest_python
base.py
Source:base.py
...87 if 'name' not in kwargs:88 name = data_utils.rand_name(cls.__name__ + '-Volume')89 kwargs['name'] = name90 volume = cls.volumes_client.create_volume(**kwargs)['volume']91 cls.addClassResourceCleanup(92 cls.volumes_client.wait_for_resource_deletion, volume['id'])93 cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,94 cls.volumes_client.delete_volume,95 volume['id'])96 waiters.wait_for_volume_resource_status(cls.volumes_client,97 volume['id'], wait_until)98 return volume99 @classmethod100 def create_snapshot(cls, volume_id=1, **kwargs):101 """Wrapper utility that returns a test snapshot."""102 if 'name' not in kwargs:103 name = data_utils.rand_name(cls.__name__ + '-Snapshot')104 kwargs['name'] = name105 snapshot = cls.snapshots_client.create_snapshot(106 volume_id=volume_id, **kwargs)['snapshot']107 cls.addClassResourceCleanup(108 cls.snapshots_client.wait_for_resource_deletion, snapshot['id'])109 cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,110 cls.snapshots_client.delete_snapshot,111 snapshot['id'])112 waiters.wait_for_volume_resource_status(cls.snapshots_client,113 snapshot['id'], 'available')114 return snapshot115 def create_backup(self, volume_id, backup_client=None, **kwargs):116 """Wrapper utility that returns a test backup."""117 if backup_client is None:118 backup_client = self.backups_client119 if 'name' not in kwargs:120 name = data_utils.rand_name(self.__class__.__name__ + '-Backup')121 kwargs['name'] = name122 backup = backup_client.create_backup(123 volume_id=volume_id, **kwargs)['backup']...
test_volume_unicode.py
Source:test_volume_unicode.py
...33 if 'name' not in kwargs:34 kwargs['name'] = data_utils.rand_name('Volume')35 kwargs['size'] = CONF.volume.volume_size36 volume = cls.volumes_client.create_volume(**kwargs)['volume']37 cls.addClassResourceCleanup(38 cls.volumes_client.wait_for_resource_deletion, volume['id'])39 cls.addClassResourceCleanup(test_utils.call_and_ignore_notfound_exc,40 cls.volumes_client.delete_volume,41 volume['id'])42 waiters.wait_for_volume_resource_status(cls.volumes_client,43 volume['id'],44 'available')45 return volume46 def test_create_delete_unicode_volume_name(self):47 """Create a volume with a unicode name and view it."""48 result = self.volumes_client.show_volume(self.volume['id'])49 fetched_volume = result['volume']50 self.assertEqual(fetched_volume['name'],...
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!!