How to use _test_create_network method in tempest

Best Python code snippet using tempest_python

test_cli20_network.py

Source:test_cli20_network.py Github

copy

Full Screen

...22from neutronclient.tests.unit import test_cli2023class CLITestV20CreateNetworkJSON(test_cli20.CLITestV20Base):24 def setUp(self):25 super(CLITestV20CreateNetworkJSON, self).setUp(plurals={'tags': 'tag'})26 def _test_create_network(self, **kwargs):27 cmd = network.CreateNetwork(test_cli20.MyApp(sys.stdout), None)28 resource = kwargs.pop('resource', 'network')29 name = kwargs.pop('name', 'myname')30 myid = kwargs.pop('myid', 'myid')31 args = kwargs.pop('args', [name, ])32 position_names = kwargs.pop('position_names', ['name', ])33 position_values = kwargs.pop('position_values', [name, ])34 self._test_create_resource(resource, cmd, name, myid, args,35 position_names, position_values,36 **kwargs)37 def test_create_network(self):38 # Create net: myname.39 self._test_create_network()40 def test_create_network_with_unicode(self):41 # Create net: u'\u7f51\u7edc'.42 self._test_create_network(name=u'\u7f51\u7edc')43 def test_create_network_description(self):44 # Create net: --tenant_id tenantid myname.45 name = 'myname'46 args = ['--description', 'Nice network', name]47 self._test_create_network(name=name,48 args=args,49 description='Nice network')50 def test_create_network_tenant_underscore(self):51 # Create net: --tenant_id tenantid myname.52 name = 'myname'53 args = ['--tenant_id', 'tenantid', name]54 self._test_create_network(name=name, args=args, tenant_id="tenantid")55 def test_create_network_tenant_dash(self):56 # Test dashed options57 # Create net: --tenant_id tenantid myname.58 name = 'myname'59 args = ['--tenant-id', 'tenantid', name]60 self._test_create_network(name=name, args=args, tenant_id="tenantid")61 def test_create_network_provider_args(self):62 # Create net: with --provider arguments.63 # Test --provider attributes before network name64 name = 'myname'65 args = ['--provider:network_type', 'vlan',66 '--provider:physical_network', 'physnet1',67 '--provider:segmentation_id', '400', name]68 position_names = ['provider:network_type',69 'provider:physical_network',70 'provider:segmentation_id', 'name']71 position_values = ['vlan', 'physnet1', '400', name]72 self._test_create_network(name=name,73 args=args,74 position_names=position_names,75 position_values=position_values)76 def test_create_network_tags(self):77 # Create net: myname --tags a b.78 name = 'myname'79 args = [name, '--tags', 'a', 'b']80 self._test_create_network(name=name, args=args, tags=['a', 'b'])81 def test_create_network_state_underscore(self):82 # Create net: --admin_state_down myname.83 name = 'myname'84 args = ['--admin_state_down', name, ]85 self._test_create_network(name=name, args=args, admin_state_up=False)86 def test_create_network_state_dash(self):87 # Test dashed options88 name = 'myname'89 args = ['--admin-state-down', name, ]90 self._test_create_network(name=name, args=args, admin_state_up=False)91 def test_create_network_vlan_transparent(self):92 # Create net: myname --vlan-transparent True.93 name = 'myname'94 args = ['--vlan-transparent', 'True', name]95 self._test_create_network(name=name,96 args=args,97 vlan_transparent='True')98 def test_create_network_with_qos_policy(self):99 # Create net: --qos-policy mypolicy.100 name = 'myname'101 qos_policy_name = 'mypolicy'102 args = [name, '--qos-policy', qos_policy_name]103 position_names = ['name', 'qos_policy_id']104 position_values = [name, qos_policy_name]105 self._test_create_network(name=name,106 args=args,107 position_names=position_names,108 position_values=position_values)109 def test_create_network_with_az_hint(self):110 # Create net: --availability-zone-hint zone1111 # --availability-zone-hint zone2.112 name = 'myname'113 args = ['--availability-zone-hint', 'zone1',114 '--availability-zone-hint', 'zone2', name]115 position_names = ['availability_zone_hints', 'name']116 position_values = [['zone1', 'zone2'], name]117 self._test_create_network(name=name,118 args=args,119 position_names=position_names,120 position_values=position_values)121 def test_create_network_with_dns_domain(self):122 # Create net: --dns-domain my-domain.org.123 name = 'myname'124 dns_domain_name = 'my-domain.org.'125 args = [name, '--dns-domain', dns_domain_name]126 position_names = ['name', 'dns_domain']127 position_values = [name, dns_domain_name]128 self._test_create_network(name=name,129 args=args,130 position_names=position_names,131 position_values=position_values)132class CLITestV20ListNetworkJSON(test_cli20.CLITestV20Base):133 def setUp(self):134 super(CLITestV20ListNetworkJSON, self).setUp(plurals={'tags': 'tag'})135 def test_list_nets_empty_with_column(self):136 resources = "networks"137 cmd = network.ListNetwork(test_cli20.MyApp(sys.stdout), None)138 self.mox.StubOutWithMock(cmd, "get_client")139 self.mox.StubOutWithMock(self.client.httpclient, "request")140 self.mox.StubOutWithMock(network.ListNetwork, "extend_list")141 network.ListNetwork.extend_list(mox.IsA(list), mox.IgnoreArg())142 cmd.get_client().MultipleTimes().AndReturn(self.client)...

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