Best Python code snippet using tempest_python
appliance_manager.py
Source: appliance_manager.py
...109 if not subnets_client:110 subnets_client = self.subnets_client111 if not routers_client:112 routers_client = self.routers_client113 def cidr_in_use(cidr, tenant_id):114 """Check cidr existence115 :returns: True if subnet with cidr already exist in tenant116 False else117 """118 cidr_in_use = \119 self.os_admin.subnets_client.list_subnets(tenant_id=tenant_id,120 cidr=cidr)['subnets']121 return len(cidr_in_use) != 0122 if ip_version == 6:123 tenant_cidr = (cidr or netaddr.IPNetwork(124 CONF.network.project_network_v6_cidr))125 mask_bits = mask_bits or CONF.network.project_network_v6_mask_bits126 else:127 tenant_cidr = cidr or netaddr.IPNetwork(128 CONF.network.project_network_cidr)129 mask_bits = mask_bits or CONF.network.project_network_mask_bits130 str_cidr = str(tenant_cidr)131 if not cidr:132 # Repeatedly attempt subnet creation with sequential cidr133 # blocks until an unallocated block is found.134 for subnet_cidr in tenant_cidr.subnet(mask_bits):135 str_cidr = str(subnet_cidr)136 if not cidr_in_use(str_cidr, tenant_id=network['tenant_id']):137 break138 else:139 if cidr_in_use(str_cidr, tenant_id=network['tenant_id']):140 LOG.error("Specified subnet %r is in use" % str_cidr)141 raise142 subnet = dict(name=data_utils.rand_name(subnet_name_),143 network_id=network['id'], tenant_id=network['tenant_id'],144 cidr=str_cidr, ip_version=ip_version, **kwargs)145 try:146 result = None147 result = subnets_client.create_subnet(**subnet)148 except lib_exc.Conflict as e:149 is_overlapping_cidr = 'overlaps with another subnet' in str(e)150 if not is_overlapping_cidr:151 raise152 self.assertIsNotNone(result, 'Unable to allocate tenant network')153 subnet = result['subnet']...
base.py
Source: base.py
...135 'ip_version': 4}136 if values:137 kwargs.update(values)138 client = client or self.subnets_client139 def cidr_in_use(cidr, project_id):140 """Check cidr existence141 :returns: True if subnet with cidr already exist in tenant142 False else143 """144 cidr_in_use = self.os_admin.subnets_client.list_subnets(145 project_id=project_id, cidr=cidr)['subnets']146 return len(cidr_in_use) != 0147 if allocate_cidr:148 tenant_cidr = netaddr.IPNetwork(CONF.network.project_network_cidr)149 num_bits = CONF.network.project_network_mask_bits150 subnet = None151 str_cidr = None152 # Repeatedly attempt subnet creation with sequential cidr153 # blocks until an unallocated block is found.154 for subnet_cidr in tenant_cidr.subnet(num_bits):155 str_cidr = str(subnet_cidr)156 if cidr_in_use(str_cidr, project_id=network['project_id']):157 continue158 kwargs['cidr'] = str_cidr159 try:160 subnet = client.create_subnet(**kwargs)['subnet']161 self.addCleanup(client.delete_subnet, subnet['id'])162 break163 except lib_exc.Conflict as e:164 is_overlapping_cidr = \165 'overlaps with another subnet' in str(e)166 if not is_overlapping_cidr:167 raise168 self.assertIsNotNone(subnet, 'Unable to allocate tenant network')169 self.assertEqual(subnet['cidr'], str_cidr)170 return subnet...
network_base.py
Source: network_base.py
...88 def create_subnet(self, network, client=None,89 namestart='subnet-smoke', **kwargs):90 if not client:91 client = self.subnets_client92 def cidr_in_use(cidr, tenant_id):93 """94 :return True if subnet with cidr already exist in tenant95 False else96 """97 cidr_in_use = self._list_subnets(tenant_id=tenant_id, cidr=cidr)98 return len(cidr_in_use) != 099 ip_version = kwargs.pop('ip_version', 4)100 if ip_version == 6:101 netaddr.IPNetwork(102 CONF.network.project_network_v6_cidr)103 CONF.network.project_network_v6_mask_bits104 else:105 netaddr.IPNetwork(CONF.network.project_network_cidr)106 CONF.network.project_network_mask_bits...
Check out the latest blogs from LambdaTest on this topic:
These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.
I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.
I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.
To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.
When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.
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!!