How to use test_delete_network method in tempest

Best Python code snippet using tempest_python

network_test.py

Source:network_test.py Github

copy

Full Screen

...13 cls.test_get_by_id_network(data_for_local)14 print('-Test %d: get all local networks' % cls.which_test_case())15 cls.test_get_all_networks(data_for_local)16 print('-Test %d: delete local network' % cls.which_test_case())17 cls.test_delete_network(data_for_local)18 if GeneralConfigurations.remote_member:19 data_for_remote = {GeneralConfigurations.provider: GeneralConfigurations.remote_member}20 print('-Test %d: post remote network' % cls.which_test_case())21 cls.test_post_networks(data_for_remote)22 print('-Test %d: get remote network by id' % cls.which_test_case())23 cls.test_get_by_id_network(data_for_remote)24 print('-Test %d: get all remote networks' % cls.which_test_case())25 cls.test_get_all_networks(data_for_remote)26 print('-Test %d: delete remote network' % cls.which_test_case())27 cls.test_delete_network(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_networks(cls, data):35 extra_data = {}36 extra_data.update(data)37 order_id = CommonMethods.post_network(extra_data)38 if not order_id:39 print(' Failed. Could not create network')40 return False41 if CommonMethods.wait_instance_ready(order_id, GeneralConfigurations.type_network):42 print(' Ok. Removing network')43 else:44 print(' Failed. Network was not ready')45 CommonMethods.delete_order(order_id, GeneralConfigurations.type_network)46 # Get tests47 @classmethod48 def test_get_by_id_network(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_network)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_network(extra_data)57 if not order_id:58 print(' Failed when creating network, trying next test')59 return60 if GeneralConfigurations.provider in extra_data:61 #if it is remote, we need to wait order request to be received62 time.sleep(10)63 response_get = CommonMethods.get_order_by_id(order_id, GeneralConfigurations.type_network)64 if response_get.status_code == GeneralConfigurations.ok_status:65 print(' Ok. Removing network')66 else:67 print(' Failed. Expecting %d status, but got: %d. Removing network' % (GeneralConfigurations.ok_status, response_get.status_code))68 CommonMethods.delete_order(order_id, GeneralConfigurations.type_network)69 time.sleep(10)70 @classmethod71 def test_get_all_networks(cls, data):72 extra_data = {}73 extra_data.update(data)74 response_get = CommonMethods.get_all_order(GeneralConfigurations.type_network)75 time.sleep(10)76 if response_get.status_code != GeneralConfigurations.ok_status or response_get.text != '[]':77 print(' Failed. There was a network created already. Received http status %d and message: %s' % (response_get.status_code, response_get.text))78 return79 orders_id = CommonMethods.post_multiple_orders(extra_data, GeneralConfigurations.max_networks, GeneralConfigurations.type_network)80 if not orders_id:81 print(' Failed. Could not create networks')82 return83 if GeneralConfigurations.provider in extra_data:84 #if it is remote, we need to wait order request to be received85 time.sleep(10)86 response_get = CommonMethods.get_all_order(GeneralConfigurations.type_network)87 test_ok = not (response_get.status_code != GeneralConfigurations.ok_status or response_get.text == '[]' or len(response_get.json()) != GeneralConfigurations.max_networks)88 if test_ok:89 print(' Ok. Removing networks')90 else:91 print(' Failed. Removing networks')92 CommonMethods.delete_multiple_orders(orders_id, GeneralConfigurations.type_network)93 if GeneralConfigurations.provider in extra_data:94 #if it is remote, we need to wait order request to be received95 time.sleep(40)96 else:97 time.sleep(10)98 # Delete tests99 @classmethod100 def test_delete_network(cls, data):101 extra_data = {}102 extra_data.update(data)103 order_id = CommonMethods.post_network(extra_data)104 if not order_id:105 print(' Failed. Could not crete network')106 return107 if GeneralConfigurations.provider in extra_data:108 #if it is remote, we need to wait order request to be received109 time.sleep(10)110 get_response = CommonMethods.get_order_by_id(order_id, GeneralConfigurations.type_network)111 if (get_response.status_code == GeneralConfigurations.not_found_status):112 print(' Failed. Got http status: %d' % (get_response.status_code))113 CommonMethods.delete_order(order_id, GeneralConfigurations.type_network)114 return...

Full Screen

Full Screen

test_nutanix.py

Source:test_nutanix.py Github

copy

Full Screen

...94 #test_get_network_info(session)95 #test_create_network(session)96 #test_create_network_managed(session)97 #test_is_network_used(session)98 #test_delete_network(session)99def test_get_network_names(session):100 result = session.get_network_names()101 print(result)102def test_get_network_info(session):103 result = session.get_network_info('Net-10.149')104 print(result)105def test_create_network(session):106 result = session.create_network('yuichi-network', 110)107 print(result)108def test_is_network_used(session):109 result = session.is_network_used('vlan.0')110 print(result)111def test_create_network_managed(session):112 result = session.create_network_managed('Net-10.149', 0, '10.149.0.0', 17, '10.149.0.1', [('10.149.27.50', '10.149.27.199')], '8.8.8.8')113 print(result)114def test_delete_network(session):115 result = session.delete_network('Net-10.149')116 print(result)117###118### VM119###120def test_vm_all(session):121 #test_get_vm_names(session)122 #test_create_vm_from_image(session)123 test_get_vm_info(session)124def test_get_vm_names(session):125 result = session.get_vm_names()126 print(result)127def test_get_vm_info(session):128 result = session.get_vm_info('rest_test')...

Full Screen

Full Screen

test_14_delete_network.py

Source:test_14_delete_network.py Github

copy

Full Screen

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

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