Best Python code snippet using tempest_python
test_ports_client.py
Source:test_ports_client.py
...103 {"port": self.FAKE_PORTS["ports"][0]},104 bytes_body,105 201,106 **self.FAKE_PORT1)107 def _test_create_bulk_ports(self, bytes_body=False):108 self.check_service_client_function(109 self.ports_client.create_bulk_ports,110 "tempest.lib.common.rest_client.RestClient.post",111 self.FAKE_PORTS,112 bytes_body,113 201,114 ports=self.FAKE_PORTS_REQ)115 def _test_show_port(self, bytes_body=False):116 self.check_service_client_function(117 self.ports_client.show_port,118 "tempest.lib.common.rest_client.RestClient.get",119 {"port": self.FAKE_PORTS["ports"][0]},120 bytes_body,121 200,122 port_id=self.FAKE_PORT_ID)123 def _test_update_port(self, bytes_body=False):124 update_kwargs = {125 "admin_state_up": True,126 "device_id": "d90a13da-be41-461f-9f99-1dbcf438fdf2",127 "device_owner": "compute:nova",128 "name": "test-for-port-update"129 }130 resp_body = {131 "port": copy.deepcopy(132 self.FAKE_PORTS["ports"][0]133 )134 }135 resp_body["port"].update(update_kwargs)136 self.check_service_client_function(137 self.ports_client.update_port,138 "tempest.lib.common.rest_client.RestClient.put",139 resp_body,140 bytes_body,141 200,142 port_id=self.FAKE_PORT_ID,143 **update_kwargs)144 def test_delete_port(self):145 self.check_service_client_function(146 self.ports_client.delete_port,147 "tempest.lib.common.rest_client.RestClient.delete",148 {},149 status=204,150 port_id=self.FAKE_PORT_ID)151 def test_list_ports_with_str_body(self):152 self._test_list_ports()153 def test_list_ports_with_bytes_body(self):154 self._test_list_ports(bytes_body=True)155 def test_create_port_with_str_body(self):156 self._test_create_port()157 def test_create_port_with_bytes_body(self):158 self._test_create_port(bytes_body=True)159 def test_create_bulk_port_with_str_body(self):160 self._test_create_bulk_ports()161 def test_create_bulk_port_with_bytes_body(self):162 self._test_create_bulk_ports(bytes_body=True)163 def test_show_port_with_str_body(self):164 self._test_show_port()165 def test_show_port_with_bytes_body(self):166 self._test_show_port(bytes_body=True)167 def test_update_port_with_str_body(self):168 self._test_update_port()169 def test_update_port_with_bytes_body(self):...
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!!