Best Python code snippet using lisa_python
test_port_forwarding.py
Source:test_port_forwarding.py  
...120        else:121            get_log().error('ä¿®æ¹UDPåè®®ç端å£è½¬å失败')122            assert False123    @allure.title('端å£è½¬åï¼å表å é¤æé®ï¼ç¹å»ætoastæç¤º[NOC-8386]')124    def test_5_delete_port_forwarding(self,driver):125        """端å£è½¬åï¼å表å é¤æé®ï¼ç¹å»ætoastæç¤º[NOC-8386]"""126        port_forwarding_fun.delete_port_forwarding(driver,expect_ip=delete_Port_forwarding["local_ip"] # TCPåè®®çæ¬å°ip127                                                   ,expect_portnum3=delete_Port_forwarding["port_num3"],# 第ä¸ä¸ªæ¬å°ç«¯å£å·128                                                   expect_portnum4=delete_Port_forwarding["port_num4"])# 第äºä¸ªæ¬å°ç«¯å£å·129        #å ä¸ºå é¤çæ¯ååå建çTCPåè®®ï¼æä»¥è¿éç第ä¸ä¸ªç«¯å£å·å第äºä¸ªæ¬å°ç«¯å£å·ä¸TCPåè®®ä¸ç两个端å£ä¸è´130        result=port_forwarding_fun.check_delet_port_forwarding(driver,expect_ip=delete_Port_forwarding["local_ip"],# TCPåè®®çæ¬å°ip131                                                               expect_portnum3=delete_Port_forwarding["port_num3"],# 第ä¸ä¸ªæ¬å°ç«¯å£å·132                                                               expect_portnum4=delete_Port_forwarding["port_num4"],# 第äºä¸ªæ¬å°ç«¯å£å·133                                                               expect_operation_type=delete_Port_forwarding["type"])# æä½ç±»å134        if result:135            get_log().info('å é¤TCPåè®®ç端å£è½¬åæå')136            assert True137        else:138            get_log().error('å é¤TCPåè®®ç端å£è½¬å失败')...port_forwarding.py
Source:port_forwarding.py  
...106            assert True107        else:108            print('ä¿®æ¹UDPåè®®ç端å£è½¬å失败')109            assert False110    def test_5_delete_port_forwarding(self):111        """端å£è½¬åï¼å表å é¤æé®ï¼ç¹å»ætoastæç¤º[NOC-8386]"""112        port_forwarding_fun.delete_port_forwarding(self.driver,expect_ip=delete_Port_forwarding["local_ip"] # TCPåè®®çæ¬å°ip113                                                   ,expect_portnum3=delete_Port_forwarding["port_num3"],# 第ä¸ä¸ªæ¬å°ç«¯å£å·114                                                   expect_portnum4=delete_Port_forwarding["port_num4"])# 第äºä¸ªæ¬å°ç«¯å£å·115        #å ä¸ºå é¤çæ¯ååå建çTCPåè®®ï¼æä»¥è¿éç第ä¸ä¸ªç«¯å£å·å第äºä¸ªæ¬å°ç«¯å£å·ä¸TCPåè®®ä¸ç两个端å£ä¸è´116        result=port_forwarding_fun.check_delet_port_forwarding(self.driver,expect_ip=delete_Port_forwarding["local_ip"],# TCPåè®®çæ¬å°ip117                                                        expect_portnum3=delete_Port_forwarding["port_num3"],# 第ä¸ä¸ªæ¬å°ç«¯å£å·118                                                        expect_portnum4=delete_Port_forwarding["port_num4"],# 第äºä¸ªæ¬å°ç«¯å£å·119                                                        expect_operation_type=delete_Port_forwarding["type"])# æä½ç±»å120        if result:121            print('å é¤TCPåè®®ç端å£è½¬åæå')122            assert True123        else:124            print('å é¤TCPåè®®ç端å£è½¬å失败')125            assert False126if __name__ == '__main__':...urls.py
Source:urls.py  
1# Copyright 2012 United States Government as represented by the2# Administrator of the National Aeronautics and Space Administration.3# All Rights Reserved.4#5# Copyright 2012 Nebula, Inc.6#7#    Licensed under the Apache License, Version 2.0 (the "License"); you may8#    not use this file except in compliance with the License. You may obtain9#    a copy of the License at10#11#         http://www.apache.org/licenses/LICENSE-2.012#13#    Unless required by applicable law or agreed to in writing, software14#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT15#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the16#    License for the specific language governing permissions and limitations17#    under the License.18from django.conf.urls import url19from openstack_dashboard.dashboards.project.floating_ips import views20urlpatterns = [21    url(r'^$', views.IndexView.as_view(), name='index'),22    url(r'^associate/$', views.AssociateView.as_view(), name='associate'),23    url(r'^allocate/$', views.AllocateView.as_view(), name='allocate'),24    url(r'^forwarding/$', views.ForwardingView.as_view(), name='forwarding'),25    url(r'^delete_port_forwarding/(?P<ip_id>[^/]+)/$',views.DeleteForwardingView.as_view(), name='delete_port_forwarding'),...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!!
