def test_list(self): """@Test: Check if Subnet can be listed @Feature: Subnet - List @Assert: Subnet is listed """ # Fetch current total result = Subnet.list() total_subnet = len(result.stdout) # Make a new subnet try: make_subnet() except CLIFactoryError as err: self.fail(err) # Fetch total again result = Subnet.list() self.assertGreater( len(result.stdout), total_subnet, "Total subnets should have increased")
def test_list(self): """@Test: Check if Subnet can be listed @Feature: Subnet - List @Assert: Subnet is listed """ # Fetch current total subnets_before = Subnet.list() # Make a new subnet make_subnet() # Fetch total again subnets_after = Subnet.list() self.assertGreater(len(subnets_after), len(subnets_before))
def test_positive_list(self): """Check if Subnet can be listed @id: 2ee376f7-9dd9-4b46-b414-801197d5455c @Assert: Subnet is listed """ # Fetch current total subnets_before = Subnet.list() # Make a new subnet make_subnet() # Fetch total again subnets_after = Subnet.list() self.assertGreater(len(subnets_after), len(subnets_before))
def test_positive_list(self): """Check if Subnet can be listed @Feature: Subnet - List @Assert: Subnet is listed """ # Fetch current total subnets_before = Subnet.list() # Make a new subnet make_subnet() # Fetch total again subnets_after = Subnet.list() self.assertGreater(len(subnets_after), len(subnets_before))
def test_list(self): """ @Feature: Subnet - List @Test: Check if Subnet can be listed @Assert: Subnet is listed """ result = Subnet.list({'per-page': '10'}) self.assertGreater(len(result.stdout), 0, "Subnet list - returns > 0 records")
def test_list(self): """ @Test: Check if Subnet can be listed @Feature: Subnet - List @Assert: Subnet is listed """ # Fetch current total result = Subnet.list() total_subnet = len(result.stdout) # Make a new subnet make_subnet() # Fetch total again result = Subnet.list() self.assertGreater( len(result.stdout), total_subnet, "Total subnets should have increased")
def test_positive_list(self): """Check if Subnet can be listed @id: 2ee376f7-9dd9-4b46-b414-801197d5455c @Assert: Subnet is listed """ # Make a new subnet subnet = make_subnet() # Fetch ids from subnets list subnets_ids = [subnet_["id"] for subnet_ in Subnet.list()] self.assertIn(subnet["id"], subnets_ids)
def test_positive_list(self): """Check if Subnet can be listed :id: 2ee376f7-9dd9-4b46-b414-801197d5455c :expectedresults: Subnet is listed """ # Make a new subnet subnet = make_subnet() # Fetch ids from subnets list subnets_ids = [subnet_['id'] for subnet_ in Subnet.list()] self.assertIn(subnet['id'], subnets_ids)
def test_positive_list(self): """Check if Subnet can be listed :id: 2ee376f7-9dd9-4b46-b414-801197d5455c :expectedresults: Subnet is listed :CaseImportance: Critical """ # Make a new subnet subnet = make_subnet() # Fetch ids from subnets list subnets_ids = [subnet_['id'] for subnet_ in Subnet.list()] self.assertIn(subnet['id'], subnets_ids)
def test_positive_CRUD(self): """Create, update and delete subnet :id: d74a52a7-df56-44ef-89a3-081c14e81e43 :expectedresults: Subnet is created, updated and deleted :CaseImportance: Critical """ name = valid_data_list()[0] pool = sorted(valid_addr_pools()[0]) mask = '255.255.255.0' # generate pool range from network address network = gen_ipaddr() from_ip = re.sub(r'\d+$', str(pool[0]), network) to_ip = re.sub(r'\d+$', str(pool[1]), network) domains_amount = random.randint(3, 5) domains = [make_domain() for _ in range(domains_amount)] gateway = gen_ipaddr(ip3=True) ipam_type = SUBNET_IPAM_TYPES['dhcp'] subnet = make_subnet( { 'name': name, 'from': from_ip, 'mask': mask, 'network': network, 'to': to_ip, 'domain-ids': [domain['id'] for domain in domains], 'gateway': gateway, 'ipam': ipam_type, } ) # Check if Subnet can be listed subnets_ids = [subnet_['id'] for subnet_ in Subnet.list()] self.assertIn(subnet['id'], subnets_ids) self.assertEqual(subnet['name'], name) self.assertEqual(subnet['start-of-ip-range'], from_ip) self.assertEqual(subnet['end-of-ip-range'], to_ip) self.assertEqual(len(subnet['domains']), domains_amount) for domain in domains: self.assertIn(domain['name'], subnet['domains']) self.assertIn(gateway, subnet['gateway-addr']) self.assertIn(ipam_type, subnet['ipam']) # update subnet new_name = valid_data_list()[0] pool = sorted(valid_addr_pools()[0]) # generate pool range from network address new_network = gen_ipaddr() new_mask = '255.255.192.0' ip_from = re.sub(r'\d+$', str(pool[0]), new_network) ip_to = re.sub(r'\d+$', str(pool[1]), new_network) ipam_type = SUBNET_IPAM_TYPES['internal'] Subnet.update( { 'new-name': new_name, 'from': ip_from, 'id': subnet['id'], 'to': ip_to, 'mask': new_mask, 'network': new_network, 'ipam': ipam_type, 'domain-ids': "", # delete domains needed for subnet delete } ) subnet = Subnet.info({'id': subnet['id']}) self.assertEqual(subnet['name'], new_name) self.assertEqual(subnet['start-of-ip-range'], ip_from) self.assertEqual(subnet['end-of-ip-range'], ip_to) self.assertEqual(subnet['network-addr'], new_network) self.assertEqual(subnet['network-mask'], new_mask) self.assertIn(ipam_type, subnet['ipam']) # delete subnet Subnet.delete({'id': subnet['id']}) with self.assertRaises(CLIReturnCodeError): Subnet.info({'id': subnet['id']})