Exemplo n.º 1
0
    def test_positive_add_domain(self):
        """Create new subnet and associate domain with it

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created with domain associated
        """
        strategy1, value1 = common_locators['entity_deselect']
        strategy2, value2 = common_locators['entity_checkbox']
        name = gen_string('alpha')
        domain = entities.Domain(organization=[self.organization]).create()
        with Session(self.browser) as session:
            make_subnet(
                session,
                org=self.organization.name,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
                domains=[domain.name],
            )
            subnet = self.subnet.search(name)
            session.nav.click(subnet)
            session.nav.click(tab_locators['subnet.tab_domain'])
            element = session.nav.wait_until_element(
                (strategy1, value1 % domain.name))
            checkbox_element = session.nav.wait_until_element(
                (strategy2, value2 % domain.name))
            # Depending upon the number of domains either, checkbox or
            # selection list appears.
            if element is None and checkbox_element is None:
                raise UIError('Neither checkbox or select list is present')
            if checkbox_element:
                self.assertTrue(checkbox_element.is_selected())
Exemplo n.º 2
0
    def test_positive_sort_by_network(self):
        """Create some Subnet entities and sort them by network address

        :id: 63dc846e-7520-4e8c-8875-a0109d7e5df4

        :customerscenario: true

        :expectedresults: Subnet entities are sorted by network address

        :BZ: 1268085, 1494180

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        network_list = [gen_ipaddr(ip3=True) for _ in range(5)]
        network_list.sort(key=lambda s: map(int, s.split('.')), reverse=True)
        with Session(self) as session:
            set_context(session, org=organization.name)
            for ip in network_list:
                make_subnet(
                    session,
                    subnet_name=gen_string('alpha'),
                    subnet_network=ip,
                    subnet_mask=gen_netmask(),
                )
            sorted_list_asc = self.subnet.sort_table_by_column(
                'Network address')
            self.assertEqual([el.split('/', 1)[0] for el in sorted_list_asc],
                             network_list[::-1])
            sorted_list_desc = self.subnet.sort_table_by_column(
                'Network address')
            self.assertEqual([el.split('/', 1)[0] for el in sorted_list_desc],
                             network_list)
Exemplo n.º 3
0
    def test_positive_add_domain(self):
        """Create new subnet and associate domain with it

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created with domain associated
        """
        strategy1, value1 = common_locators['entity_deselect']
        strategy2, value2 = common_locators['entity_checkbox']
        name = gen_string('alpha')
        domain = entities.Domain(
            organization=[self.organization]
        ).create()
        with Session(self.browser) as session:
            make_subnet(
                session,
                org=self.organization.name,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
                domains=[domain.name],
            )
            subnet = self.subnet.search(name)
            session.nav.click(subnet)
            session.nav.click(tab_locators['subnet.tab_domain'])
            element = session.nav.wait_until_element(
                (strategy1, value1 % domain.name))
            checkbox_element = session.nav.wait_until_element(
                (strategy2, value2 % domain.name))
            # Depending upon the number of domains either, checkbox or
            # selection list appears.
            if element is None and checkbox_element is None:
                raise UIError('Neither checkbox or select list is present')
            if checkbox_element:
                self.assertTrue(checkbox_element.is_selected())
Exemplo n.º 4
0
    def test_positive_add_domain(self):
        """Create new subnet and associate domain with it

        :id: adbc7189-b451-49df-aa10-2ae732832dfe

        :expectedresults: Subnet is created with domain associated

        :CaseLevel: Integration
        """
        name = gen_string('alpha')
        domain = entities.Domain(
            organization=[self.organization]
        ).create()
        with Session(self.browser) as session:
            make_subnet(
                session,
                org=self.organization.name,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
                domains=[domain.name],
            )
            self.subnet.search_and_click(name)
            self.subnet.click(tab_locators['subnet.tab_domain'])
            element = self.subnet.wait_until_element(
                common_locators['entity_deselect'] % domain.name)
            checkbox_element = self.subnet.wait_until_element(
                common_locators['entity_checkbox'] % domain.name)
            # Depending upon the number of domains either, checkbox or
            # selection list appears.
            if element is None and checkbox_element is None:
                raise UIError('Neither checkbox or select list is present')
            if checkbox_element:
                self.assertTrue(checkbox_element.is_selected())
Exemplo n.º 5
0
    def test_create_subnet_3(self):
        """@Test: Create new subnet and associate domain with it

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created with domain associated

        """
        strategy1, value1 = common_locators["entity_deselect"]
        strategy2, value2 = common_locators["entity_checkbox"]
        name = gen_string("alpha", 4)
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        domain_name = entities.Domain().create()['name']
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask, domains=[domain_name])
            self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name))
            session.nav.search_entity(
                name, locators['subnet.display_name']).click()
            session.nav.wait_until_element(
                tab_locators["subnet.tab_domain"]).click()
            element = session.nav.wait_until_element(
                (strategy1, value1 % domain_name))
            checkbox_element = session.nav.wait_until_element(
                (strategy2, value2 % domain_name))
            # Depending upon the number of domains either, checkbox or
            # selection list appears.
            if element:
                self.assertIsNotNone(element)
            elif checkbox_element:
                self.assertTrue(checkbox_element.is_selected())
            else:
                self.assertIsNotNone()
Exemplo n.º 6
0
    def test_positive_sort_by_name(self):
        """Create some Subnet entities and sort them by name

        :id: 0b07341c-717e-46a9-86cc-7192f3d8d449

        :customerscenario: true

        :expectedresults: Subnet entities are sorted by name

        :BZ: 1268085

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        name_list = [gen_string('alpha', 20) for _ in range(5)]
        with Session(self) as session:
            set_context(session, org=organization.name)
            for name in name_list:
                make_subnet(
                    session,
                    subnet_name=name,
                    subnet_network=gen_ipaddr(ip3=True),
                    subnet_mask=gen_netmask(),
                )
            self.assertEqual(self.subnet.sort_table_by_column('Name'),
                             sorted(name_list, key=six.text_type.lower))
            self.assertEqual(
                self.subnet.sort_table_by_column('Name'),
                sorted(name_list, key=six.text_type.lower, reverse=True))
Exemplo n.º 7
0
    def test_positive_sort_by_name(self):
        """Create some Subnet entities and sort them by name

        :id: 0b07341c-717e-46a9-86cc-7192f3d8d449

        :expectedresults: Subnet entities are sorted by name

        :BZ: 1268085

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        name_list = [gen_string('alpha', 20) for _ in range(5)]
        with Session(self) as session:
            set_context(session, org=organization.name)
            for name in name_list:
                make_subnet(
                    session,
                    subnet_name=name,
                    subnet_network=gen_ipaddr(ip3=True),
                    subnet_mask=gen_netmask(),
                )
            self.assertEqual(
                self.subnet.sort_table_by_column('Name'),
                sorted(name_list, key=six.text_type.lower)
            )
            self.assertEqual(
                self.subnet.sort_table_by_column('Name'),
                sorted(name_list, key=six.text_type.lower, reverse=True)
            )
Exemplo n.º 8
0
    def test_positive_sort_by_network(self):
        """Create some Subnet entities and sort them by network address

        :id: 63dc846e-7520-4e8c-8875-a0109d7e5df4

        :expectedresults: Subnet entities are sorted by network address

        :BZ: 1268085, 1494180

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        network_list = [gen_ipaddr(ip3=True) for _ in range(5)]
        network_list.sort(key=lambda s: map(int, s.split('.')), reverse=True)
        with Session(self) as session:
            set_context(session, org=organization.name)
            for ip in network_list:
                make_subnet(
                    session,
                    subnet_name=gen_string('alpha'),
                    subnet_network=ip,
                    subnet_mask=gen_netmask(),
                )
            sorted_list_asc = self.subnet.sort_table_by_column(
                'Network address')
            self.assertEqual(
                [el.split('/', 1)[0] for el in sorted_list_asc],
                network_list[::-1]
            )
            sorted_list_desc = self.subnet.sort_table_by_column(
                'Network address')
            self.assertEqual(
                [el.split('/', 1)[0] for el in sorted_list_desc],
                network_list
            )
Exemplo n.º 9
0
    def test_positive_add_domain(self):
        """Create new subnet and associate domain with it

        :id: adbc7189-b451-49df-aa10-2ae732832dfe

        :expectedresults: Subnet is created with domain associated

        :CaseLevel: Integration
        """
        name = gen_string('alpha')
        domain = entities.Domain(
            organization=[self.organization]
        ).create()
        with Session(self) as session:
            make_subnet(
                session,
                org=self.organization.name,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
                domains=[domain.name],
            )
            self.subnet.search_and_click(name)
            self.subnet.click(tab_locators['subnet.tab_domain'])
            element = self.subnet.wait_until_element(
                common_locators['entity_deselect'] % domain.name)
            checkbox_element = self.subnet.wait_until_element(
                common_locators['entity_checkbox'] % domain.name)
            # Depending upon the number of domains either, checkbox or
            # selection list appears.
            if element is None and checkbox_element is None:
                raise UIError('Neither checkbox or select list is present')
            if checkbox_element:
                self.assertTrue(checkbox_element.is_selected())
Exemplo n.º 10
0
    def test_update_subnet_3(self, name):
        """@Test: Update Subnet mask

        @Feature: Subnet - Positive Update

        @Assert: Subnet mask is updated

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask(1, 15)
        new_mask = gen_netmask(16, 31)
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.subnet.update(name, new_subnet_mask=new_mask)
            result_object = self.subnet.search_subnet(name)
            self.assertEqual(new_mask, result_object['mask'])
Exemplo n.º 11
0
    def test_positive_update_mask(self):
        """Update Subnet mask

        @id: 6cc5de06-5463-4919-abe4-92cef4506a54

        @Assert: Subnet mask is updated
        """
        name = gen_string('alpha')
        new_mask = gen_netmask(16, 31)
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(1, 15),
            )
            self.subnet.update(name, new_subnet_mask=new_mask)
            result_object = self.subnet.search_and_validate(name)
            self.assertEqual(new_mask, result_object['mask'])
Exemplo n.º 12
0
    def test_update_subnet_3(self, name):
        """@Test: Update Subnet mask

        @Feature: Subnet - Positive Update

        @Assert: Subnet mask is updated

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask(1, 15)
        new_mask = gen_netmask(16, 31)
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            self.subnet.update(name, new_subnet_mask=new_mask)
            result_object = self.subnet.search_subnet(name)
            self.assertEqual(new_mask, result_object['mask'])
Exemplo n.º 13
0
    def test_positive_update_mask(self):
        """Update Subnet mask

        @Feature: Subnet - Positive Update

        @Assert: Subnet mask is updated
        """
        name = gen_string('alpha')
        new_mask = gen_netmask(16, 31)
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(1, 15),
            )
            self.subnet.update(name, new_subnet_mask=new_mask)
            result_object = self.subnet.search_and_validate(name)
            self.assertEqual(new_mask, result_object['mask'])
Exemplo n.º 14
0
    def test_positive_update_mask(self):
        """Update Subnet mask

        :id: 6cc5de06-5463-4919-abe4-92cef4506a54

        :expectedresults: Subnet mask is updated

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        new_mask = gen_netmask(16, 31)
        with Session(self) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(1, 15),
            )
            self.subnet.update(name, new_subnet_mask=new_mask)
            result_object = self.subnet.search_and_validate(name)
            self.assertEqual(new_mask, result_object['mask'])
Exemplo n.º 15
0
 def test_gen_netmask_boundary(self):
     """Test gen_netmask boundary cases"""
     self.assertEqual(u'0.0.0.0', gen_netmask(0, 0))
     self.assertEqual(u'255.255.255.255', gen_netmask(32, 32))
     with self.assertRaises(ValueError):
         gen_netmask(-1, 16)
     with self.assertRaises(ValueError):
         gen_netmask(16, 33)
Exemplo n.º 16
0
def test_gen_netmask_boundary():
    """Test gen_netmask boundary cases."""
    assert gen_netmask(0, 0) == '0.0.0.0'
    assert gen_netmask(32, 32) == '255.255.255.255'
    with pytest.raises(ValueError):
        gen_netmask(-1, 16)
    with pytest.raises(ValueError):
        gen_netmask(16, 33)
Exemplo n.º 17
0
 def test_gen_netmask_boundary(self):
     """Test gen_netmask boundary cases"""
     self.assertEqual(u'0.0.0.0', gen_netmask(0, 0))
     self.assertEqual(u'255.255.255.255', gen_netmask(32, 32))
     with self.assertRaises(ValueError):
         gen_netmask(-1, 16)
     with self.assertRaises(ValueError):
         gen_netmask(16, 33)
Exemplo n.º 18
0
    def test_create_subnet_negative_1(self, name):
        """@Test: Create new subnet with 256 characters in name

        @Feature: Subnet - Negative Create

        @Assert: Subnet is not created with 256 chars

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.assertIsNone(self.subnet.search_subnet(subnet_name=name))
Exemplo n.º 19
0
    def test_create_subnet_1(self, name):
        """@Test: Create new subnet

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name))
Exemplo n.º 20
0
    def test_create_subnet_negative_2(self, name):
        """@Test: Create new subnet with whitespace and blank in name.

        @Feature: Subnet - Negative Create.

        @Assert: Subnet is not created.

        """

        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.assertIsNone(self.subnet.search_subnet(subnet_name=name))
Exemplo n.º 21
0
    def test_create_subnet_negative_2(self, name):
        """@Test: Create new subnet with whitespace and blank in name.

        @Feature: Subnet - Negative Create.

        @Assert: Subnet is not created.

        """
        locator = common_locators["haserror"]
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            error_element = session.nav.wait_until_element(locator)
            self.assertIsNotNone(error_element)
Exemplo n.º 22
0
    def test_create_subnet_1(self, name):
        """@Test: Create new subnet

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name))
Exemplo n.º 23
0
    def test_remove_subnet(self, name):
        """@Test: Delete a subnet

        @Feature: Subnet - Positive Delete

        @Assert: Subnet is deleted

        """
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.delete(name)
Exemplo n.º 24
0
    def test_remove_subnet_1(self, name):
        """@Test: Delete a subnet

        @Feature: Subnet - Positive Delete

        @Assert: Subnet is deleted

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.subnet.delete(name, True)
            self.assertIsNone(self.subnet.search_subnet(
                subnet_name=name, timeout=5))
Exemplo n.º 25
0
    def test_positive_create_with_name(self):
        """Create new subnet using different names

        @id: 2318f13c-db38-4919-831f-667fc6e2e7bf

        @Assert: Subnet is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=8):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(name))
Exemplo n.º 26
0
    def test_negative_delete(self):
        """Delete subnet. Attempt to delete subnet, but cancel in the
        confirmation dialog box.

        @id: 9eed9020-8d13-4ba0-909a-db44ad0aecb6

        @Assert: Subnet is not deleted
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.delete(name, really=False)
Exemplo n.º 27
0
    def test_positive_delete(self):
        """Delete an existing subnet

        @id: cb1265de-a0ed-40b7-ba25-fe92251b9001

        @Assert: Subnet is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=8):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.subnet.delete(name)
Exemplo n.º 28
0
    def test_positive_delete(self):
        """Delete an existing subnet

        @Feature: Subnet - Positive Delete

        @Assert: Subnet is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=8):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.subnet.delete(name)
Exemplo n.º 29
0
    def test_positive_delete(self):
        """Delete an existing subnet

        @id: cb1265de-a0ed-40b7-ba25-fe92251b9001

        @Assert: Subnet is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=8):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.subnet.delete(name)
Exemplo n.º 30
0
    def test_negative_delete(self):
        """Delete subnet. Attempt to delete subnet, but cancel in the
        confirmation dialog box.

        @id: 9eed9020-8d13-4ba0-909a-db44ad0aecb6

        @Assert: Subnet is not deleted
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.delete(name, really=False)
Exemplo n.º 31
0
    def test_negative_delete(self):
        """Delete subnet. Attempt to delete subnet, but cancel in the
        confirmation dialog box.

        @Feature: Subnet - Negative Delete

        @Assert: Subnet is not deleted
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.delete(name, really=False)
Exemplo n.º 32
0
    def test_negative_delete(self):
        """Delete subnet. Attempt to delete subnet, but cancel in the
        confirmation dialog box.

        @Feature: Subnet - Negative Delete

        @Assert: Subnet is not deleted
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.delete(name, really=False)
Exemplo n.º 33
0
    def test_search_subnet_1(self, name):
        """@Test: Search Subnet with Subnet name

        @Feature: Subnet - Positive Search

        @Assert: Subnet is found

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            result_object = self.subnet.search_subnet(name)
            self.assertEqual(name, result_object['name'])
            self.assertEqual(network, result_object['network'])
            self.assertEqual(mask, result_object['mask'])
Exemplo n.º 34
0
    def test_positive_delete(self):
        """Delete an existing subnet

        @Feature: Subnet - Positive Delete

        @Assert: Subnet is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=8):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.subnet.delete(name)
Exemplo n.º 35
0
    def test_update_subnet_1(self, name):
        """@Test: Update Subnet name

        @Feature: Subnet - Positive Update

        @Assert: Subnet name is updated

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        new_name = gen_string("alpha", 10)
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.subnet.update(name, new_subnet_name=new_name)
            result_object = self.subnet.search_subnet(new_name)
            self.assertEqual(new_name, result_object['name'])
Exemplo n.º 36
0
    def test_create_subnet_negative_with_too_long_name(self, name):
        """@Test: Create new subnet with 256 characters in name

        @Feature: Subnet - Negative Create

        @Assert: Subnet is not created with 256 chars

        """
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.assertIsNotNone(session.nav.wait_until_element(
                common_locators['haserror']))
Exemplo n.º 37
0
    def test_create_subnet_negative_with_blank_name(self, name):
        """@Test: Create new subnet with whitespace and blank in name.

        @Feature: Subnet - Negative Create.

        @Assert: Subnet is not created.

        """
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.assertIsNotNone(session.nav.wait_until_element(
                common_locators['haserror']))
Exemplo n.º 38
0
    def test_positive_create_with_name(self):
        """Create new subnet using different names

        @id: 2318f13c-db38-4919-831f-667fc6e2e7bf

        @Assert: Subnet is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(name))
Exemplo n.º 39
0
    def test_positive_create_with_name(self):
        """Create new subnet using different names

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=8):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(name))
Exemplo n.º 40
0
    def test_remove_subnet_2(self, name):
        """@Test: Delete subnet.

        Attempt to delete subnet but cancel in the confirmation dialog box.

        @Feature: Subnet - Negative Delete

        @Assert: Subnet is not deleted

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.subnet.delete(name, False)
            self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name,
                                                           timeout=5))
Exemplo n.º 41
0
    def test_negative_create_with_invalid_name(self):
        """Create new subnet with invalid names

        @Feature: Subnet - Negative Create

        @Assert: Subnet is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(session.nav.wait_until_element(
                        common_locators['haserror']))
Exemplo n.º 42
0
    def test_positive_create_with_long_name(self):
        """Create new subnet with 255 characters in name

        @id: b86772ad-a8ff-4c2b-93f4-4a715e4da59b

        @Assert: Subnet is created with 255 chars
        """
        with Session(self.browser) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(
                        self.subnet.search(name))
Exemplo n.º 43
0
    def test_remove_subnet_1(self, name):
        """@Test: Delete a subnet

        @Feature: Subnet - Positive Delete

        @Assert: Subnet is deleted

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            self.subnet.delete(name, True)
            self.assertIsNone(
                self.subnet.search_subnet(subnet_name=name, timeout=5))
Exemplo n.º 44
0
    def test_create_subnet_negative_2(self, name):
        """@Test: Create new subnet with whitespace and blank in name.

        @Feature: Subnet - Negative Create.

        @Assert: Subnet is not created.

        """
        locator = common_locators["haserror"]
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            error_element = session.nav.wait_until_element(locator)
            self.assertIsNotNone(error_element)
Exemplo n.º 45
0
    def test_remove_subnet_1(self, name):
        """@Test: Delete a subnet

        @Feature: Subnet - Positive Delete

        @Assert: Subnet is deleted

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session, subnet_name=name, subnet_network=network,
                        subnet_mask=mask)
            self.subnet.delete(name, True)
            self.assertIsNotNone(session.nav.wait_until_element(
                common_locators["notif.success"]))
            self.assertIsNone(self.subnet.search_subnet(
                subnet_name=name, timeout=5))
Exemplo n.º 46
0
    def test_positive_update_network(self):
        """Update Subnet network

        @id: f79d3b1b-6101-4009-88ad-b259d4794e6c

        @Assert: Subnet network is updated
        """
        name = gen_string('alpha')
        new_network = gen_ipaddr(ip3=True)
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.update(name, new_subnet_network=new_network)
            result_object = self.subnet.search_and_validate(name)
            self.assertEqual(new_network, result_object['network'])
Exemplo n.º 47
0
    def test_negative_create_with_invalid_name(self):
        """Create new subnet with invalid names

        @id: d53056ad-a219-40d5-b20e-95ad343c9d38

        @Assert: Subnet is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(
                        session.nav.wait_until_element(
                            common_locators['haserror']))
Exemplo n.º 48
0
    def test_positive_create_with_name(self):
        """Create new subnet using different names

        :id: 2318f13c-db38-4919-831f-667fc6e2e7bf

        :expectedresults: Subnet is created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(name))
Exemplo n.º 49
0
    def test_positive_delete(self):
        """Delete an existing subnet

        :id: cb1265de-a0ed-40b7-ba25-fe92251b9001

        :expectedresults: Subnet is deleted

        :CaseImportance: Critical
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.subnet.delete(name)
Exemplo n.º 50
0
    def test_search_subnet_1(self, name):
        """@Test: Search Subnet with Subnet name

        @Feature: Subnet - Positive Search

        @Assert: Subnet is found

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            result_object = self.subnet.search_subnet(name)
            self.assertEqual(name, result_object['name'])
            self.assertEqual(network, result_object['network'])
            self.assertEqual(mask, result_object['mask'])
Exemplo n.º 51
0
    def test_positive_create_with_name(self):
        """Create new subnet using different names

        :id: 2318f13c-db38-4919-831f-667fc6e2e7bf

        :expectedresults: Subnet is created

        :CaseImportance: Critical
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(name))
Exemplo n.º 52
0
    def test_update_subnet_1(self, name):
        """@Test: Update Subnet name

        @Feature: Subnet - Positive Update

        @Assert: Subnet name is updated

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        new_name = gen_string("alpha", 10)
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            self.subnet.update(name, new_subnet_name=new_name)
            result_object = self.subnet.search_subnet(new_name)
            self.assertEqual(new_name, result_object['name'])
Exemplo n.º 53
0
    def test_positive_create_with_long_name(self):
        """Create new subnet with 255 characters in name

        :id: b86772ad-a8ff-4c2b-93f4-4a715e4da59b

        :expectedresults: Subnet is created with 255 chars

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_subnet(
                        session,
                        subnet_name=name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(name))
Exemplo n.º 54
0
    def test_negative_delete(self):
        """Delete subnet. Attempt to delete subnet, but cancel in the
        confirmation dialog box.

        :id: 9eed9020-8d13-4ba0-909a-db44ad0aecb6

        :expectedresults: Subnet is not deleted

        :CaseImportance: Critical
        """
        name = gen_string('utf8')
        with Session(self) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            self.subnet.delete(name, really=False)
Exemplo n.º 55
0
    def test_remove_subnet_2(self, name):
        """@Test: Delete subnet.

        Attempt to delete subnet but cancel in the confirmation dialog box.

        @Feature: Subnet - Negative Delete

        @Assert: Subnet is not deleted

        """
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask)
            self.subnet.delete(name, False)
            self.assertIsNotNone(
                self.subnet.search_subnet(subnet_name=name, timeout=5))
Exemplo n.º 56
0
    def test_create_subnet_2(self, test_data):
        """@Test: Create new subnet with 255 characters in name

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created with 255 chars

        """
        bug_id = test_data.pop('bz-bug', None)
        if bug_id is not None and bz_bug_is_open(bug_id):
            self.skipTest('Bugzilla bug {0} is open.'.format(bug_id))

        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=test_data['name'],
                        subnet_network=network,
                        subnet_mask=mask)
            self.assertIsNotNone(
                self.subnet.search_subnet(subnet_name=test_data['name']))
Exemplo n.º 57
0
    def test_positive_update_name(self):
        """Update Subnet name

        @id: ec9f11e3-27a7-45d8-91fe-f04c20b595bc

        @Assert: Subnet name is updated
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_subnet(
                session,
                subnet_name=name,
                subnet_network=gen_ipaddr(ip3=True),
                subnet_mask=gen_netmask(),
            )
            for new_name in generate_strings_list(length=8):
                with self.subTest(new_name):
                    self.subnet.update(name, new_subnet_name=new_name)
                    result_object = self.subnet.search_and_validate(new_name)
                    self.assertEqual(new_name, result_object['name'])
                    name = new_name  # for next iteration
Exemplo n.º 58
0
    def test_positive_create_with_long_name(self):
        """Create new subnet with 255 characters in name

        @id: b86772ad-a8ff-4c2b-93f4-4a715e4da59b

        @Assert: Subnet is created with 255 chars
        """
        with Session(self.browser) as session:
            for test_data in valid_long_names():
                with self.subTest(test_data):
                    bug_id = test_data.pop('bz-bug', None)
                    if bug_id is not None and bz_bug_is_open(bug_id):
                        self.skipTest(
                            'Bugzilla bug {0} is open.'.format(bug_id))
                    make_subnet(
                        session,
                        subnet_name=test_data['name'],
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask=gen_netmask(),
                    )
                    self.assertIsNotNone(self.subnet.search(test_data['name']))
Exemplo n.º 59
0
    def test_create_subnet_3(self):
        """@Test: Create new subnet and associate domain with it

        @Feature: Subnet - Positive Create

        @Assert: Subnet is created with domain associated

        """
        strategy1, value1 = common_locators["entity_deselect"]
        strategy2, value2 = common_locators["entity_checkbox"]
        name = gen_string("alpha", 4)
        network = gen_ipaddr(ip3=True)
        mask = gen_netmask()
        domain_name = entities.Domain().create()['name']
        with Session(self.browser) as session:
            make_subnet(session,
                        subnet_name=name,
                        subnet_network=network,
                        subnet_mask=mask,
                        domains=[domain_name])
            self.assertIsNotNone(self.subnet.search_subnet(subnet_name=name))
            session.nav.search_entity(name,
                                      locators['subnet.display_name']).click()
            session.nav.wait_until_element(
                tab_locators["subnet.tab_domain"]).click()
            element = session.nav.wait_until_element(
                (strategy1, value1 % domain_name))
            checkbox_element = session.nav.wait_until_element(
                (strategy2, value2 % domain_name))
            # Depending upon the number of domains either, checkbox or
            # selection list appears.
            if element:
                self.assertIsNotNone(element)
            elif checkbox_element:
                self.assertTrue(checkbox_element.is_selected())
            else:
                self.assertIsNotNone()
Exemplo n.º 60
0
 def test_gen_netmask(self):
     """Test if gen_netmask generates valid values"""
     result = gen_netmask()
     self.assertEqual(len(result.split('.')), 4)
     self.assertIsNotNone(NETMASK_REGEX.match(result))