Best Python code snippet using tempest_python
actions.py
Source:actions.py
...225 vm.model.data.snapshotEpoch = str(snapshots[0]['epoch'])226 except Exception as e:227 service.model.data.result = RESULT_ERROR % (str(sys.exc_info()[:2]) + str(e))228 service.save()229def test_delete_snapshot(job):230 import sys231 RESULT_OK = 'OK : %s '232 RESULT_FAILED = 'FAILED : %s'233 RESULT_ERROR = 'ERROR : %s'234 service = job.service235 try:236 g8client = service.producers['g8client'][0]237 config_instance = "{}_{}".format(g8client.aysrepo.name, g8client.model.data.instance)238 client = j.clients.openvcloud.get(instance=config_instance, create=False, die=True, sshkey_path="/root/.ssh/ays_repos_key")239 vm = service.producers['node'][0]240 vm_id = vm.model.data.machineId241 snapshots = client.api.cloudapi.machines.listSnapshots(machineId=vm_id)242 # check if list of snapshots is empty243 if snapshots:...
test_delete_snapshot.py
Source:test_delete_snapshot.py
...6from Configs.TestData.CEVolumeTestData import CEVolumeTestData7from Locators.CE import CECreateVolumePageLocators8from Tests_Dev.CE_Snapshot.snapshot_base_test import SnapshotBaseTest9class Test_delete_snapshot(SnapshotBaseTest):10 def test_delete_snapshot(self):11 """12 TEST CASE: Delete a snapshot (created from a volume attached with a Stopped instance)13 """14 # *** Choose one volume attached with a Stopped instance ***15 # Flow of work:16 # - Create an instance + Stop instance17 # - Create a volume18 # - Attach volume to above instance19 self.choose_volume(CECreateVolumePageLocators.CUSTOM_DISK,20 True, CEVolumeTestData.SIZE2, True)21 # *** Create the volume snapshot ***22 # Flow of work:23 # - Click on Create Snapshot button24 # - Input snapshot name + Select Stopped instance...
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!!