Best Python code snippet using tempest_python
test_subnet_service_types.py
Source:test_subnet_service_types.py
...58 'enable_dhcp': enable_dhcp}59 if service_types:60 args['service_types'] = service_types61 return self._create_subnet(self.fmt, **args)62 def _test_create_subnet(self, service_types, expect_fail=False):63 res = self._create_service_subnet(service_types)64 if expect_fail:65 self.assertEqual(webob.exc.HTTPClientError.code,66 res.status_int)67 else:68 subnet = self.deserialize('json', res)69 subnet = subnet['subnet']70 self.assertEqual(len(service_types),71 len(subnet['service_types']))72 for service in service_types:73 self.assertIn(service, subnet['service_types'])74 def test_create_subnet_blank_type(self):75 self._test_create_subnet([])76 def test_create_subnet_bar_type(self):77 self._test_create_subnet(['network:bar'])78 def test_create_subnet_foo_type(self):79 self._test_create_subnet(['compute:foo'])80 def test_create_subnet_bar_and_foo_type(self):81 self._test_create_subnet(['network:bar', 'compute:foo'])82 def test_create_subnet_invalid_type(self):83 self._test_create_subnet(['foo'], expect_fail=True)84 self._test_create_subnet([1], expect_fail=True)85 def test_create_subnet_no_type(self):86 res = self._create_service_subnet()87 subnet = self.deserialize('json', res)88 subnet = subnet['subnet']89 self.assertFalse(subnet['service_types'])90 def _test_update_subnet(self, subnet, service_types, fail_code=None):91 data = {'subnet': {'service_types': service_types}}92 req = self.new_update_request('subnets', data, subnet['id'])93 res = self.deserialize(self.fmt, req.get_response(self.api))94 if fail_code is not None:95 self.assertEqual(fail_code,96 res['NeutronError']['type'])97 else:98 subnet = res['subnet']...
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!!