How to use test_delete_volume method in tempest

Best Python code snippet using tempest_python

volume_test.py

Source:volume_test.py Github

copy

Full Screen

...13 cls.test_get_by_id_volume(data_for_local)14 print('-Test %d: get all local volume' % cls.which_test_case())15 cls.test_get_all_volume(data_for_local)16 print('-Test %d: delete local volume' % cls.which_test_case())17 cls.test_delete_volume(data_for_local)18 if GeneralConfigurations.remote_member:19 data_for_remote = {GeneralConfigurations.provider: GeneralConfigurations.remote_member}20 print('-Test %d: post remote volume' % cls.which_test_case())21 cls.test_post_volumes(data_for_remote)22 print('-Test %d: get by id remote volume' % cls.which_test_case())23 cls.test_get_by_id_volume(data_for_remote)24 print('-Test %d: get all remote volume' % cls.which_test_case())25 cls.test_get_all_volume(data_for_remote)26 print('-Test %d: delete remote volume' % cls.which_test_case())27 cls.test_delete_volume(data_for_remote)28 @classmethod29 def which_test_case(cls):30 cls.test_number += 131 return cls.test_number32 #Post tests33 @classmethod34 def test_post_volumes(cls, data):35 extra_data = {}36 extra_data.update(data)37 order_id = CommonMethods.post_volume(extra_data)38 if not order_id:39 print(' Failed, volume was not created')40 return41 if CommonMethods.wait_instance_ready(order_id, GeneralConfigurations.type_volume):42 print(' Ok. Removing volume')43 else:44 print(' Failed. Removing volume')45 CommonMethods.delete_order(order_id, GeneralConfigurations.type_volume)46 # Get tests47 @classmethod48 def test_get_by_id_volume(cls, data):49 extra_data = {}50 extra_data.update(data)51 fake_id = 'fake-id'52 response_get = CommonMethods.get_order_by_id(fake_id, GeneralConfigurations.type_volume)53 if response_get.status_code != GeneralConfigurations.not_found_status:54 print(' Failed. Expecting %d status, but got: %d' % (GeneralConfigurations.not_found_status, response_get.status_code))55 return56 order_id = CommonMethods.post_volume(extra_data)57 if not order_id:58 print(' Failed on creating volume, trying next test')59 return60 if GeneralConfigurations.provider in data:61 #if it is remote, we need to wait order request to be received62 time.sleep(30)63 else:64 time.sleep(10)65 response_get = CommonMethods.get_order_by_id(order_id, GeneralConfigurations.type_volume)66 if response_get.status_code == GeneralConfigurations.ok_status:67 print(' Ok. Removing volume')68 else:69 print(' Failed. Expecting %d status, but got: %d. Removing volume' % (GeneralConfigurations.ok_status, response_get.status_code))70 CommonMethods.delete_order(order_id, GeneralConfigurations.type_volume)71 if GeneralConfigurations.provider in extra_data:72 #if it is remote, we need to wait order request to be received73 time.sleep(30)74 else:75 time.sleep(10)76 @classmethod77 def test_get_all_volume(cls, data):78 extra_data = {}79 extra_data.update(data)80 time.sleep(60)81 response_get = CommonMethods.get_all_order(GeneralConfigurations.type_volume)82 if response_get.status_code != GeneralConfigurations.ok_status or response_get.text != '[]':83 print(' Failed. There is a volume created already')84 return85 orders_id = CommonMethods.post_multiple_orders(extra_data, GeneralConfigurations.max_volumes, GeneralConfigurations.type_volume)86 if not orders_id:87 print(' Failed. Could not create volumes')88 return89 if GeneralConfigurations.provider in extra_data:90 #if it is remote, we need to wait order request to be received91 time.sleep(10)92 response_get = CommonMethods.get_all_order(GeneralConfigurations.type_volume)93 test_ok = not (response_get.status_code != GeneralConfigurations.ok_status or response_get.text == '[]' or len(response_get.json()) != GeneralConfigurations.max_volumes)94 if test_ok:95 print(' Ok. Removing volumes')96 else:97 print(' Failed. Got status %d and message: %s' % (response_get.status_code, response_get.text))98 CommonMethods.delete_multiple_orders(orders_id, GeneralConfigurations.type_volume)99 if GeneralConfigurations.provider in extra_data:100 #if it is remote, we need to wait order request to be received101 time.sleep(30)102 else:103 time.sleep(10)104 # Delete tests105 @classmethod106 def test_delete_volume(cls, data):107 extra_data = {}108 extra_data.update(data)109 order_id = CommonMethods.post_volume(extra_data)110 if not order_id:111 print(' Test Failed. Volume was not created')112 return113 if GeneralConfigurations.provider in extra_data:114 #if it is remote, we need to wait order request to be received115 time.sleep(10)116 get_response = CommonMethods.get_order_by_id(order_id, GeneralConfigurations.type_volume)117 if (get_response.status_code == GeneralConfigurations.not_found_status):118 print(' Test Failed. Volume was not found')119 return120 CommonMethods.delete_order(order_id, GeneralConfigurations.type_volume)...

Full Screen

Full Screen

test_15_delete_volume.py

Source:test_15_delete_volume.py Github

copy

Full Screen

...31 self.relevance = conf_relevance.ConfRelevance(CONF_PATH, "test_data").get_relevance_conf()32 @pytest.mark.parametrize("case_data", case_dict["test_case"])33 @allure.story("删除卷")34 @pytest.mark.flaky(reruns=3)35 def test_delete_volume(self,case_data):36 # 参数化修改test_add_project 注释37 for k, v in enumerate(case_dict["test_case"]): # 遍历用例文件中所有用例的索引和值38 try:39 if case_data == v:40 # 修改方法的__doc__在下一次调用时生效,此为展示在报告中的用例描述41 Test_Delete_volume.test_delete_volume.__doc__ = case_dict["test_case"][k + 1]["info"]42 except IndexError:43 pass44 if not self.result["result"]:45 # 查看类变量result的值,如果未False,则前一接口校验错误,此接口标记未失败,节约测试时间46 pytest.xfail("前置接口测试失败,此接口标记为失败")47 if case_data["request_type"] == "get":48 time.sleep(case_data["sleep_time"])49 #send_request(_data, _host, _address,_port, _relevance, path, _success)...

Full Screen

Full Screen

test_delete_volume.py

Source:test_delete_volume.py Github

copy

Full Screen

1"""2 Command run test:3 python3 -m unittest Tests_Dev.CE_Volume.test_delete_volume -v4 Test big flow of Delete volume5"""6import os7import time8import unittest9from selenium.webdriver.support import expected_conditions as EC10import HtmlTestRunner11from selenium.webdriver.common.by import By12from selenium.webdriver.support.wait import WebDriverWait13from Configs.TestData.CEVolumeTestData import CEVolumeTestData14from Locators.CE import CEVolumePageLocators, CEInstancePageLocators, CECreateVolumePageLocators15from Pages.CE.create_volume_page import CECreateVolumePage16from Pages.CE.homepage import CEHomePage17from Pages.CE.volume_page import CEVolumePage18from Tests_Dev.CE_Volume.volume_base_test import VolumeBaseTest19class Test_delete_volume(VolumeBaseTest):20 # def test_delete_volume_noVM(self):21 # '''22 # TEST CASE: Delete the volume not attached with any instance23 # Should SUCCEED24 # '''25 # # *** Choose one volume not attached with any instance ***26 # # Flow of work:27 # # - Create a volume28 # self.choose_volume(CECreateVolumePageLocators.CUSTOM_DISK,29 # False, CEVolumeTestData.SIZE2, False)30 # # *** Delete the newly created volume ***31 # # Flow of work:32 # # - Click on "Actions" button + Choose "Delete volume" option33 # # - Click on "Delete" button to confirm the deletion34 # # - Should SUCCEED to delete the volume35 # self.delete_volume(True)36 # time.sleep(10)37 # self.tearDown()38 #39 # def test_delete_volume_running_VM(self):40 # '''41 # TEST CASE: Delete the volume attached with a Running instance42 # Should NOT able to click on "Delete volume" option43 # '''44 # # *** Choose one volume attached with a Running instance ***45 # # Flow of work:46 # # - Create an instance47 # # - Create a volume48 # # - Attach the volume with above instance49 # self.choose_volume(CECreateVolumePageLocators.CUSTOM_DISK,50 # False, CEVolumeTestData.SIZE2, True)51 # # *** Delete the newly created volume ***52 # # Flow of work:53 # # - Click on "Actions" button54 # # - Should NOT able to click "Delete volume" button55 # self.delete_volume(False)56 # time.sleep(10)57 # self.tearDown()58 def test_delete_volume_stopped_VM(self):59 '''60 TEST CASE: Delete the volume attached with a Stopped instance61 Should NOT able to click on "Delete volume" option62 '''63 # *** Choose one volume attached with a Stopped instance ***64 # Flow of work:65 # - Create an instance + Stop instance66 # - Create a volume67 # - Attach the volume with above instance68 self.choose_volume(CECreateVolumePageLocators.CUSTOM_DISK,69 True, CEVolumeTestData.SIZE2, True)70 # *** Delete the newly created volume ***71 # Flow of work:72 # - Click on "Actions" button73 # - Should NOT able to click "Delete volume" button74 self.delete_volume(False)75 time.sleep(10)76 self.tearDown()77if __name__ == "__main__":78 unittest.main(79 testRunner=HtmlTestRunner.HTMLTestRunner(80 output=os.path.join(os.getcwd(), "Reports"))...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful