Best Python code snippet using tempest_python
test_clientlib.py
Source:test_clientlib.py
...167 data=["001", "001"],168 params={'tenant': tenant, 'format': format})169 LOG.debug("_test_show_port_details - tenant:%s "\170 "- format:%s - END", format, tenant)171 def _test_create_port(self, tenant=TENANT_1, format='json', status=200):172 LOG.debug("_test_create_port - tenant:%s "\173 "- format:%s - START", format, tenant)174 self._assert_sanity(self.client.create_port,175 status,176 "POST",177 "networks/001/ports",178 data=["001"],179 params={'tenant': tenant, 'format': format})180 LOG.debug("_test_create_port - tenant:%s "\181 "- format:%s - END", format, tenant)182 def _test_delete_port(self, tenant=TENANT_1, format='json', status=200):183 LOG.debug("_test_delete_port - tenant:%s "\184 "- format:%s - START", format, tenant)185 self._assert_sanity(self.client.delete_port,186 status,187 "DELETE",188 "networks/001/ports/001",189 data=["001", "001"],190 params={'tenant': tenant, 'format': format})191 LOG.debug("_test_delete_port - tenant:%s "\192 "- format:%s - END", format, tenant)193 def _test_set_port_state(self, tenant=TENANT_1, format='json', status=200):194 LOG.debug("_test_set_port_state - tenant:%s "\195 "- format:%s - START", format, tenant)196 self._assert_sanity(self.client.set_port_state,197 status,198 "PUT",199 "networks/001/ports/001",200 data=["001", "001",201 {'port': {'state': 'ACTIVE'}}],202 params={'tenant': tenant, 'format': format})203 LOG.debug("_test_set_port_state - tenant:%s "\204 "- format:%s - END", format, tenant)205 def _test_show_port_attachment(self,206 tenant=TENANT_1, format='json', status=200):207 LOG.debug("_test_show_port_attachment - tenant:%s "\208 "- format:%s - START", format, tenant)209 self._assert_sanity(self.client.show_port_attachment,210 status,211 "GET",212 "networks/001/ports/001/attachment",213 data=["001", "001"],214 params={'tenant': tenant, 'format': format})215 LOG.debug("_test_show_port_attachment - tenant:%s "\216 "- format:%s - END", format, tenant)217 def _test_attach_resource(self, tenant=TENANT_1,218 format='json', status=200):219 LOG.debug("_test_attach_resource - tenant:%s "\220 "- format:%s - START", format, tenant)221 self._assert_sanity(self.client.attach_resource,222 status,223 "PUT",224 "networks/001/ports/001/attachment",225 data=["001", "001",226 {'resource': {'id': '1234'}}],227 params={'tenant': tenant, 'format': format})228 LOG.debug("_test_attach_resource - tenant:%s "\229 "- format:%s - END", format, tenant)230 def _test_detach_resource(self, tenant=TENANT_1,231 format='json', status=200):232 LOG.debug("_test_detach_resource - tenant:%s "\233 "- format:%s - START", format, tenant)234 self._assert_sanity(self.client.detach_resource,235 status,236 "DELETE",237 "networks/001/ports/001/attachment",238 data=["001", "001"],239 params={'tenant': tenant, 'format': format})240 LOG.debug("_test_detach_resource - tenant:%s "\241 "- format:%s - END", format, tenant)242 def _test_ssl_certificates(self, tenant=TENANT_1,243 format='json', status=200):244 LOG.debug("_test_ssl_certificates - tenant:%s "\245 "- format:%s - START", format, tenant)246 # Set SSL, and our cert file247 self.client.use_ssl = True248 cert_file = "/fake.cert"249 self.client.key_file = self.client.cert_file = cert_file250 data = self._assert_sanity(self.client.list_networks,251 status,252 "GET",253 "networks",254 data=[],255 params={'tenant': tenant, 'format': format})256 self.assertEquals(data["key_file"], cert_file)257 self.assertEquals(data["cert_file"], cert_file)258 LOG.debug("_test_ssl_certificates - tenant:%s "\259 "- format:%s - END", format, tenant)260 def test_list_networks_json(self):261 self._test_list_networks(format='json')262 def test_list_networks_xml(self):263 self._test_list_networks(format='xml')264 def test_list_networks_alt_tenant(self):265 self._test_list_networks(tenant=TENANT_2)266 def test_list_networks_error_470(self):267 self._test_list_networks(status=470)268 def test_list_networks_error_401(self):269 self._test_list_networks(status=401)270 def test_show_network_details_json(self):271 self._test_show_network_details(format='json')272 def test_show_network_details_xml(self):273 self._test_show_network_details(format='xml')274 def test_show_network_details_alt_tenant(self):275 self._test_show_network_details(tenant=TENANT_2)276 def test_show_network_details_error_470(self):277 self._test_show_network_details(status=470)278 def test_show_network_details_error_401(self):279 self._test_show_network_details(status=401)280 def test_show_network_details_error_420(self):281 self._test_show_network_details(status=420)282 def test_create_network_json(self):283 self._test_create_network(format='json')284 def test_create_network_xml(self):285 self._test_create_network(format='xml')286 def test_create_network_alt_tenant(self):287 self._test_create_network(tenant=TENANT_2)288 def test_create_network_error_470(self):289 self._test_create_network(status=470)290 def test_create_network_error_401(self):291 self._test_create_network(status=401)292 def test_create_network_error_400(self):293 self._test_create_network(status=400)294 def test_create_network_error_422(self):295 self._test_create_network(status=422)296 def test_update_network_json(self):297 self._test_update_network(format='json')298 def test_update_network_xml(self):299 self._test_update_network(format='xml')300 def test_update_network_alt_tenant(self):301 self._test_update_network(tenant=TENANT_2)302 def test_update_network_error_470(self):303 self._test_update_network(status=470)304 def test_update_network_error_401(self):305 self._test_update_network(status=401)306 def test_update_network_error_400(self):307 self._test_update_network(status=400)308 def test_update_network_error_420(self):309 self._test_update_network(status=420)310 def test_update_network_error_422(self):311 self._test_update_network(status=422)312 def test_delete_network_json(self):313 self._test_delete_network(format='json')314 def test_delete_network_xml(self):315 self._test_delete_network(format='xml')316 def test_delete_network_alt_tenant(self):317 self._test_delete_network(tenant=TENANT_2)318 def test_delete_network_error_470(self):319 self._test_delete_network(status=470)320 def test_delete_network_error_401(self):321 self._test_delete_network(status=401)322 def test_delete_network_error_420(self):323 self._test_delete_network(status=420)324 def test_delete_network_error_421(self):325 self._test_delete_network(status=421)326 def test_list_ports_json(self):327 self._test_list_ports(format='json')328 def test_list_ports_xml(self):329 self._test_list_ports(format='xml')330 def test_list_ports_alt_tenant(self):331 self._test_list_ports(tenant=TENANT_2)332 def test_list_ports_error_470(self):333 self._test_list_ports(status=470)334 def test_list_ports_error_401(self):335 self._test_list_ports(status=401)336 def test_list_ports_error_420(self):337 self._test_list_ports(status=420)338 def test_show_port_details_json(self):339 self._test_list_ports(format='json')340 def test_show_port_details_xml(self):341 self._test_list_ports(format='xml')342 def test_show_port_details_alt_tenant(self):343 self._test_list_ports(tenant=TENANT_2)344 def test_show_port_details_error_470(self):345 self._test_show_port_details(status=470)346 def test_show_port_details_error_401(self):347 self._test_show_port_details(status=401)348 def test_show_port_details_error_420(self):349 self._test_show_port_details(status=420)350 def test_show_port_details_error_430(self):351 self._test_show_port_details(status=430)352 def test_create_port_json(self):353 self._test_create_port(format='json')354 def test_create_port_xml(self):355 self._test_create_port(format='xml')356 def test_create_port_alt_tenant(self):357 self._test_create_port(tenant=TENANT_2)358 def test_create_port_error_470(self):359 self._test_create_port(status=470)360 def test_create_port_error_401(self):361 self._test_create_port(status=401)362 def test_create_port_error_400(self):363 self._test_create_port(status=400)364 def test_create_port_error_420(self):365 self._test_create_port(status=420)366 def test_create_port_error_430(self):367 self._test_create_port(status=430)368 def test_create_port_error_431(self):369 self._test_create_port(status=431)370 def test_delete_port_json(self):371 self._test_delete_port(format='json')372 def test_delete_port_xml(self):373 self._test_delete_port(format='xml')374 def test_delete_port_alt_tenant(self):375 self._test_delete_port(tenant=TENANT_2)376 def test_delete_port_error_470(self):377 self._test_delete_port(status=470)378 def test_delete_port_error_401(self):379 self._test_delete_port(status=401)380 def test_delete_port_error_420(self):381 self._test_delete_port(status=420)382 def test_delete_port_error_430(self):383 self._test_delete_port(status=430)...
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!!