Example #1
0
    def test_create_package_filter(self):
        """@test: create content views package filter(positive)

        @feature: Content Views

        @assert: content views filter created and selected packages
        can be added for inclusion/exclusion

        """

        cv_name = gen_string("alpha", 8)
        filter_name = gen_string("alpha", 8)
        repo_name = gen_string("alpha", 8)
        content_type = FILTER_CONTENT_TYPE['package']
        filter_type = FILTER_TYPE['include']
        package_names = ['cow', 'bird', 'crow', 'bear']
        version_types = ['Equal To', 'Greater Than', 'Less Than', 'Range']
        values = ['0.3', '0.5', '0.5', '4.1']
        max_values = [None, None, None, '4.6']
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(cv_name, filter_name, content_type,
                                          filter_type)
            self.content_views.add_packages_to_filter(cv_name, filter_name,
                                                      package_names,
                                                      version_types, values,
                                                      max_values)
Example #2
0
    def test_cv_associate_composite_dupe_repos_negative(self):
        """@test: attempt to associate the same repo multiple times within a
        content view

        @feature: Content Views

        @assert: User cannot add repos multiple times to the view

        """
        cv_name = gen_string('alpha')
        repo_name = gen_string('alpha')
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
            with self.assertRaises(UIError) as context:
                self.content_views.add_remove_repos(cv_name, [repo_name])
                self.assertEqual(
                    context.exception.message,
                    'Could not find repo "{0}" to add into CV'
                    .format(repo_name)
                )
Example #3
0
    def test_cv_associate_composite_dupe_repos_negative(self):
        """@test: attempt to associate the same repo multiple times within a
        content view

        @feature: Content Views

        @assert: User cannot add repos multiple times to the view

        """

        cv_name = gen_string("alpha", 8)
        repo_name = gen_string("alpha", 8)
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
            with self.assertRaises(Exception) as context:
                self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertEqual(
                context.exception.message, "Couldn't find repo '%s'"
                "to add into CV" % repo_name)
Example #4
0
    def test_cv_associate_puppet_repo_negative(self):
        # Again, individual modules should be ok.
        """@test: attempt to associate puppet repos within a composite
        content view

        @feature: Content Views

        @assert: User cannot create a composite content view
        that contains direct puppet repos.

        """

        composite_name = gen_string("alpha", 8)
        puppet_module = "httpd"
        module_ver = 'Latest'
        with Session(self.browser) as session:
            make_contentview(session,
                             org=self.org_name,
                             name=composite_name,
                             is_composite=True)
            self.assertIsNotNone(self.content_views.search(composite_name))
            with self.assertRaises(Exception) as context:
                self.content_views.add_puppet_module(composite_name,
                                                     puppet_module,
                                                     filter_term=module_ver)
            self.assertEqual(context.exception.message,
                             'Could not find tab to add puppet_modules')
Example #5
0
    def test_cv_publish_custom_content(self):
        """@test: attempt to publish a content view containing custom content

        @feature: Content Views

        @setup: Multiple environments for an org; custom content synced

        @assert: Content view can be published

        """

        repo_name = gen_string("alpha", 8)
        env_name = gen_string("alpha", 8)
        cv_name = gen_string("alpha", 8)
        strategy, value = locators["content_env.select_name"]
        with Session(self.browser) as session:
            make_lifecycle_environment(session,
                                       org=self.org_name,
                                       name=env_name)
            self.assertIsNotNone(
                session.nav.wait_until_element((strategy, value % env_name)))
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
Example #6
0
    def test_create_package_group_filter(self):
        """@test: create content views package group filter(positive)

        @feature: Content Views

        @assert: content views filter created and selected package groups
        can be added for inclusion/exclusion

        """
        cv_name = gen_string("alpha", 8)
        filter_name = gen_string("alpha", 8)
        repo_name = gen_string("alpha", 8)
        content_type = FILTER_CONTENT_TYPE['package group']
        filter_type = FILTER_TYPE['include']
        package_group = 'mammals'
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(cv_name, filter_name,
                                          content_type, filter_type)
            self.content_views.add_remove_package_groups_to_filter(
                cv_name,
                filter_name,
                [package_group]
            )
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
Example #7
0
    def test_create_errata_filter(self):
        """@test: create content views errata filter(positive)

        @feature: Content Views

        @assert: content views filter created and selected errata-id
        can be added for inclusion/exclusion

        """

        cv_name = gen_string("alpha", 8)
        filter_name = gen_string("alpha", 8)
        repo_name = gen_string("alpha", 8)
        content_type = FILTER_CONTENT_TYPE['erratum by id']
        filter_type = FILTER_TYPE['include']
        errata_ids = ['RHEA-2012:0001', 'RHEA-2012:0004']
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(cv_name, filter_name, content_type,
                                          filter_type)
            self.content_views.add_remove_errata_to_filter(
                cv_name, filter_name, errata_ids)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
Example #8
0
    def test_cv_publish_rh(self):
        """@test: attempt to publish a content view containing RH content

        @feature: Content Views

        @setup: RH content synced

        @assert: Content view can be published

        """
        cv_name = gen_string('alpha')
        rh_repo = {
            'name': REPOS['rhst7']['name'],
            'product': PRDS['rhel'],
            'reposet': REPOSET['rhst7'],
            'basearch': 'x86_64',
            'releasever': None,
        }
        # Create new org to import manifest
        org = entities.Organization().create()
        with Session(self.browser) as session:
            self.setup_to_create_cv(rh_repo=rh_repo, org_id=org.id)
            # Create content-view
            make_contentview(session, org=org.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [rh_repo['name']])
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
Example #9
0
    def test_create_package_filter(self):
        """@test: create content views package filter(positive)

        @feature: Content Views

        @assert: content views filter created and selected packages
        can be added for inclusion/exclusion

        """
        cv_name = gen_string('alpha')
        filter_name = gen_string('alpha')
        repo_name = gen_string('alpha')
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(
                cv_name,
                filter_name,
                FILTER_CONTENT_TYPE['package'],
                FILTER_TYPE['include'],
            )
            self.content_views.add_packages_to_filter(
                cv_name,
                filter_name,
                ['cow', 'bird', 'crow', 'bear'],
                ['Equal To', 'Greater Than', 'Less Than', 'Range'],
                ['0.3', '0.5', '0.5', '4.1'],
                [None, None, None, '4.6'],
            )
Example #10
0
    def test_cv_publish_rh_1(self):
        """@test: attempt to publish a content view containing RH content

        @feature: Content Views

        @setup: RH content synced

        @assert: Content view can be published

        """
        cv_name = gen_string("alpha", 8)
        rh_repo = {
            'name': ("Red Hat Enterprise Linux 6 Server "
                     "- RH Common RPMs x86_64 6.3"),
            'product': "Red Hat Enterprise Linux Server",
            'reposet': ("Red Hat Enterprise Linux 6 Server "
                        "- RH Common (RPMs)"),
            'basearch': "x86_64",
            'releasever': "6.3"
        }
        # Create new org to import manifest
        org_attrs = entities.Organization().create_json()
        org_id = org_attrs['id']
        with Session(self.browser) as session:
            self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id)
            # Create content-view
            make_contentview(session, org=org_attrs['name'], name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [rh_repo['name']])
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
Example #11
0
    def test_cv_associate_puppet_repo_negative(self):
        # Again, individual modules should be ok.
        """@test: attempt to associate puppet repos within a composite
        content view

        @feature: Content Views

        @assert: User cannot create a composite content view
        that contains direct puppet repos.

        """
        composite_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_contentview(
                session,
                org=self.organization.name,
                name=composite_name,
                is_composite=True
            )
            self.assertIsNotNone(self.content_views.search(composite_name))
            with self.assertRaises(UIError) as context:
                self.content_views.add_puppet_module(
                    composite_name, 'httpd', filter_term='Latest')
                self.assertEqual(
                    context.exception.message,
                    'Could not find tab to add puppet_modules'
                )
Example #12
0
    def test_create_errata_filter(self):
        """@test: create content views errata filter(positive)

        @feature: Content Views

        @assert: content views filter created and selected errata-id
        can be added for inclusion/exclusion

        """
        cv_name = gen_string('alpha')
        filter_name = gen_string('alpha')
        repo_name = gen_string('alpha')
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(
                cv_name,
                filter_name,
                FILTER_CONTENT_TYPE['erratum by id'],
                FILTER_TYPE['include'],
            )
            self.content_views.add_remove_errata_to_filter(
                cv_name, filter_name, ['RHEA-2012:0001', 'RHEA-2012:0004'])
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
Example #13
0
    def test_cv_associate_components_composite_negative(self):
        """@test: attempt to associate components to a non-composite
        content view

        @feature: Content Views

        @assert: User cannot add components to the view

        """
        cv1_name = gen_string('alpha')
        cv2_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_contentview(
                session, org=self.organization.name, name=cv1_name)
            self.assertIsNotNone(self.content_views.search(cv1_name))
            make_contentview(
                session, org=self.organization.name, name=cv2_name)
            self.assertIsNotNone(self.content_views.search(cv2_name))
            with self.assertRaises(UIError) as context:
                self.content_views.add_remove_cv(cv1_name, [cv2_name])
                self.assertEqual(
                    context.exception.message,
                    'Could not find ContentView tab, please make sure '
                    'selected view is composite'
                )
Example #14
0
    def test_positive_add_package_group_filter(self):
        """@test: add package group to content views filter

        @feature: Content Views

        @assert: content views filter created and selected package groups
        can be added for inclusion/exclusion
        """
        cv_name = gen_string('alpha')
        filter_name = gen_string('alpha')
        repo_name = gen_string('alpha')
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(
                cv_name,
                filter_name,
                FILTER_CONTENT_TYPE['package group'],
                FILTER_TYPE['include'],
            )
            self.content_views.add_remove_package_groups_to_filter(
                cv_name,
                filter_name,
                ['mammals']
            )
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
Example #15
0
    def test_positive_clone_within_same_env(self):
        """@test: attempt to create new content view based on existing
        view within environment

        @feature: Content Views

        @assert: Content view can be cloned
        """
        repo_name = gen_string('alpha')
        cv_name = gen_string('alpha')
        copy_cv_name = gen_string('alpha')
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            # Add repository to selected CV
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success'])
            )
            # Publish the CV
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success'])
            )
            # Copy the CV
            self.content_views.copy_view(cv_name, copy_cv_name)
            self.assertIsNotNone(self.content_views.search(copy_cv_name))
            self.assertEqual(
                repo_name,
                self.content_views.fetch_yum_content_repo_name(copy_cv_name)
            )
Example #16
0
    def test_associate_view_rh_1(self):
        """@test: associate Red Hat content in a view

        @feature: Content Views

        @setup: Sync RH content

        @assert: RH Content can be seen in a view

        """
        cv_name = gen_string("alpha", 8)
        rh_repo = {
            'name': ("Red Hat Enterprise Linux 6 Server "
                     "- RH Common RPMs x86_64 6.3"),
            'product':
            "Red Hat Enterprise Linux Server",
            'reposet': ("Red Hat Enterprise Linux 6 Server "
                        "- RH Common (RPMs)"),
            'basearch':
            "x86_64",
            'releasever':
            "6.3"
        }
        # Create new org to import manifest
        org_attrs = entities.Organization().create()
        org_id = org_attrs['id']
        with Session(self.browser) as session:
            self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id)
            # Create content-view
            make_contentview(session, org=org_attrs['name'], name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [rh_repo['name']])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
Example #17
0
    def test_associate_puppet_module(self):
        """@test: create content view with puppet repository

        @feature: Content Views

        @steps:
        1. Create Product/puppet repo and Sync it
        2. Create CV and add puppet modules from created repo

        @assert: content view is created, updated with puppet module

        """
        repo_url = FAKE_0_PUPPET_REPO
        cv_name = gen_string('alpha')
        puppet_module = 'httpd'
        with Session(self.browser) as session:
            self.setup_to_create_cv(
                repo_url=repo_url, repo_type=REPO_TYPE['puppet'])
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_puppet_module(
                cv_name,
                puppet_module,
                filter_term='Latest',
            )
        # Workaround to fetch added puppet module name:
        # UI doesn't refresh and populate the added module name
        # until we logout and navigate again to puppet-module tab
        with Session(self.browser) as session:
            session.nav.go_to_select_org(self.organization.name)
            session.nav.go_to_content_views()
            module = self.content_views.fetch_puppet_module(
                cv_name, puppet_module)
            self.assertIsNotNone(module)
Example #18
0
    def test_positive_update_description(self):
        """Update content views description to valid one.

        :id: f5e46a3b-c317-4575-9c66-ef1da1926f66

        :expectedresults: Content view is updated successfully and has proper
            description

        :CaseImportance: Critical
        """
        name = gen_string('alpha', 8)
        desc = gen_string('alpha', 15)
        with Session(self) as session:
            make_contentview(
                session,
                org=self.organization.name,
                name=name,
                description=desc,
            )
            self.assertIsNotNone(self.content_views.search(name))
            for new_desc in valid_data_list():
                with self.subTest(new_desc):
                    self.content_views.update(name, new_description=new_desc)
                    self.content_views.search_and_click(name)
                    self.content_views.click(
                        tab_locators['contentviews.tab_details'])
                    self.assertEqual(
                        self.content_views.wait_until_element(
                            locators['contentviews.fetch_description']).text,
                        new_desc
                    )
Example #19
0
    def test_associate_view_rh_1(self):
        """@test: associate Red Hat content in a view

        @feature: Content Views

        @setup: Sync RH content

        @assert: RH Content can be seen in a view

        """
        cv_name = gen_string("alpha", 8)
        rh_repo = {
            'name': REPOS['rhst7']['name'],
            'product': PRDS['rhel'],
            'reposet': REPOSET['rhst7'],
            'basearch': 'x86_64',
            'releasever': None
        }
        # Create new org to import manifest
        org_attrs = entities.Organization().create_json()
        org_id = org_attrs['id']
        with Session(self.browser) as session:
            self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id)
            # Create content-view
            make_contentview(session, org=org_attrs['name'], name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [rh_repo['name']])
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
    def test_positive_update_description(self):
        """Update content views description to valid one.

        :id: f5e46a3b-c317-4575-9c66-ef1da1926f66

        :expectedresults: Content view is updated successfully and has proper
            description

        :CaseImportance: Critical
        """
        name = gen_string('alpha', 8)
        desc = gen_string('alpha', 15)
        with Session(self) as session:
            make_contentview(
                session,
                org=self.organization.name,
                name=name,
                description=desc,
            )
            self.assertIsNotNone(self.content_views.search(name))
            for new_desc in valid_data_list():
                with self.subTest(new_desc):
                    self.content_views.update(name, new_description=new_desc)
                    self.content_views.search_and_click(name)
                    self.content_views.click(
                        tab_locators['contentviews.tab_details'])
                    self.assertEqual(
                        self.content_views.wait_until_element(
                            locators['contentviews.fetch_description']).text,
                        new_desc)
Example #21
0
    def test_cv_publish_custom_content(self):
        """@test: attempt to publish a content view containing custom content

        @feature: Content Views

        @setup: Multiple environments for an org; custom content synced

        @assert: Content view can be published

        """
        repo_name = gen_string('alpha')
        env_name = gen_string('alpha')
        cv_name = gen_string('alpha')
        strategy, value = locators['content_env.select_name']
        with Session(self.browser) as session:
            make_lifecycle_environment(
                session, org=self.organization.name, name=env_name)
            self.assertIsNotNone(session.nav.wait_until_element(
                (strategy, value % env_name)))
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
Example #22
0
    def test_associate_puppet_module(self):
        """@test: create content view with puppet repository

        @feature: Content Views

        @steps:
        1. Create Product/puppet repo and Sync it
        2. Create CV and add puppet modules from created repo

        @assert: content view is created, updated with puppet module

        """

        repo_url = FAKE_0_PUPPET_REPO
        cv_name = gen_string("alpha", 8)
        puppet_module = "httpd"
        module_ver = 'Latest'
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_url=repo_url,
                                    repo_type=REPO_TYPE['puppet'])
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_puppet_module(cv_name,
                                                 puppet_module,
                                                 filter_term=module_ver)
        # Workaround to fetch added puppet module name:
        # UI doesn't refresh and populate the added module name
        # until we logout and navigate again to puppet-module tab
        with Session(self.browser) as session:
            session.nav.go_to_select_org(self.org_name)
            session.nav.go_to_content_views()
            module = self.content_views.fetch_puppet_module(
                cv_name, puppet_module)
            self.assertIsNotNone(module)
Example #23
0
    def test_create_package_group_filter(self):
        """@test: create content views package group filter(positive)

        @feature: Content Views

        @assert: content views filter created and selected package groups
        can be added for inclusion/exclusion

        """
        cv_name = gen_string("alpha", 8)
        filter_name = gen_string("alpha", 8)
        repo_name = gen_string("alpha", 8)
        content_type = FILTER_CONTENT_TYPE['package group']
        filter_type = FILTER_TYPE['include']
        package_group = 'mammals'
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.content_views.add_filter(cv_name, filter_name, content_type,
                                          filter_type)
            self.content_views.add_remove_package_groups_to_filter(
                cv_name, filter_name, [package_group])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
Example #24
0
    def test_positive_srpm_sync_publish_promote_cv(self):
        """Synchronize repository with SRPMs, add repository to content view,
        publish and promote content view to lifecycle environment

        @id: 4563d1c1-cdce-4838-a67f-c0a5d4e996a6

        @Assert: srpms can be listed in content view in proper lifecycle
        environment
        """
        lce = entities.LifecycleEnvironment(
            organization=self.session_org).create()
        product = entities.Product(organization=self.session_org).create()
        repo_name = gen_string('alphanumeric')
        cv_name = gen_string('alphanumeric')
        with Session(self.browser) as session:
            self.products.search(product.name).click()
            make_repository(
                session,
                name=repo_name,
                url=FAKE_YUM_SRPM_REPO,
            )
            self.assertIsNotNone(self.repository.search(repo_name))
            self.setup_navigate_syncnow(
                session,
                product.name,
                repo_name,
            )
            self.assertTrue(self.prd_sync_is_ok(repo_name))

            make_contentview(session, org=self.session_org.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))
            self.content_views.promote(cv_name, 'Version 1', lce.name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))
        result = ssh.command(
            'ls /var/lib/pulp/published/yum/https/repos/{}/{}/{}/custom/{}/{}/'
            ' | grep .src.rpm'.format(
                self.session_org.label,
                lce.name,
                cv_name,
                product.label,
                repo_name,
            ))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Example #25
0
    def test_cv_promote_rh_1(self):
        """@test: attempt to promote a content view containing RH content

        @feature: Content Views

        @setup: Multiple environments for an org; RH content synced

        @assert: Content view can be promoted

        """
        cv_name = gen_string("alpha", 8)
        rh_repo = {
            'name': ("Red Hat Enterprise Linux 6 Server "
                     "- RH Common RPMs x86_64 6.3"),
            'product':
            "Red Hat Enterprise Linux Server",
            'reposet': ("Red Hat Enterprise Linux 6 Server "
                        "- RH Common (RPMs)"),
            'basearch':
            "x86_64",
            'releasever':
            "6.3"
        }
        env_name = gen_string("alpha", 8)
        publish_version = "Version 1"
        strategy, value = locators["content_env.select_name"]
        # Create new org to import manifest
        org_attrs = entities.Organization().create()
        org_id = org_attrs['id']
        org_name = org_attrs['name']
        with Session(self.browser) as session:
            make_lifecycle_environment(session, org=org_name, name=env_name)
            self.assertIsNotNone(
                session.nav.wait_until_element((strategy, value % env_name)))
            self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id)
            # Create content-view
            make_contentview(session, org=org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [rh_repo['name']])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
            self.content_views.promote(cv_name, publish_version, env_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
Example #26
0
    def test_cv_create(self, name):
        """@test: create content views (positive)

        @feature: Content Views

        @assert: content views are created

        """
        with Session(self.browser) as session:
            make_contentview(
                session, org=self.organization.name, name=name)
            self.assertIsNotNone(
                self.content_views.search(name),
                'Failed to find content view %s from %s org' % (
                    name, self.organization.name))
Example #27
0
    def test_cv_end_2_end(self):
        """@test: create content view with yum repo, publish it
        and promote it to Library +1 env

        @feature: Content Views

        @steps:
        1. Create Product/repo and Sync it
        2. Create CV and add created repo in step1
        3. Publish and promote it to 'Library'
        4. Promote it to next environment

        @assert: content view is created, updated with repo publish and
        promoted to next selected env

        """

        repo_name = gen_string("alpha", 8)
        env_name = gen_string("alpha", 8)
        cv_name = gen_string("alpha", 8)
        publish_version = "Version 1"
        strategy, value = locators["content_env.select_name"]
        with Session(self.browser) as session:
            # Create Life-cycle environment
            make_lifecycle_environment(session,
                                       org=self.org_name,
                                       name=env_name)
            self.assertIsNotNone(
                session.nav.wait_until_element((strategy, value % env_name)))
            # Creates a CV along with product and sync'ed repository
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            # Add repository to selected CV
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
            # Publish and promote CV to next environment
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
            self.content_views.promote(cv_name, publish_version, env_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
    def setup_to_create_cv(self, session, cv_name, repo_name=None,
                           repo_url=None, repo_type=None, rh_repo=None):
        """Create product/repo and sync it and create CV"""
        cv_name = cv_name or gen_string("alpha", 8)

        if not rh_repo:
            repo_name = repo_name or gen_string("alpha", 8)

            # Creates new custom product via API's
            product_attrs = entities.Product(
                organization=self.org_id
            ).create()

            # Creates new custom repository via API's
            repo_attrs = entities.Repository(
                name=repo_name,
                url=(repo_url or FAKE_1_YUM_REPO),
                content_type=(repo_type or REPO_TYPE['yum']),
                product=product_attrs['id'],
            ).create()
            repo_id = repo_attrs['id']
        elif rh_repo:
            # Clone the manifest and fetch it's path.
            manifest_path = manifests.clone()
            # Uploads the manifest and returns the result.
            task_result = entities.Organization(
                id=self.org_id
            ).upload_manifest(path=manifest_path)['result']
            self.assertEqual(u'success', task_result)

            # Enables the RedHat repo and fetches it's Id.
            repo_id = utils.enable_rhrepo_and_fetchid(
                rh_repo['basearch'],
                str(self.org_id),  # Org Id is passed as data in API hence str
                rh_repo['product'],
                rh_repo['name'],
                rh_repo['reposet'],
                rh_repo['releasever'])
            repo_name = rh_repo['name']

        # Sync repository
        task_result = entities.Repository(id=repo_id).sync()['result']
        self.assertEqual(
            task_result,
            u'success',
            u"Sync for repository {0} failed.".format(repo_name))
        make_contentview(session, org=self.org_name, name=cv_name)
        self.assertIsNotNone(self.content_views.search(cv_name))
Example #29
0
    def test_positive_create_wth_name(self):
        """@test: Create content views using different names

        @feature: Content Views

        @assert: Content views are created
        """
        with Session(self.browser) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_contentview(
                        session, org=self.organization.name, name=name)
                    self.assertIsNotNone(
                        self.content_views.search(name),
                        'Failed to find content view %s from %s org' % (
                            name, self.organization.name)
                    )
Example #30
0
    def test_negative_cv_update_name(self, new_name):
        """@test: Negative update content views - name.

        @feature: Content Views

        @assert: Content View is not updated,  Appropriate error shown.

        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_contentview(
                session, org=self.organization.name, name=name)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_name)
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.error']))
            self.assertIsNone(self.content_views.search(new_name))
Example #31
0
    def test_cv_create(self, name):
        """@test: create content views (positive)

        @feature: Content Views

        @assert: content views are created

        @BZ: 1083086

        """

        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name, name=name)
            self.assertIsNotNone(
                self.content_views.search(name),
                'Failed to find content view %s from %s org' %
                (name, self.org_name))
Example #32
0
    def test_positive_cv_update_name(self, new_name):
        """@test: Positive update content views - name.

        @feature: Content Views

        @assert: edited content view save is successful and info is
        updated

        """
        name = gen_string("alpha", 8)
        desc = gen_string("alpha", 15)
        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name,
                             name=name, description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_name)
            self.assertIsNotNone(self.content_views.search(new_name))
Example #33
0
    def test_positive_srpm_sync_publish_cv(self):
        """Synchronize repository with SRPMs, add repository to content view
        and publish content view

        @id: 2a57cbde-c616-440d-8bcb-6e18bd2d5c5f

        @Assert: srpms can be listed in content view
        """
        product = entities.Product(organization=self.session_org).create()
        repo_name = gen_string('alphanumeric')
        cv_name = gen_string('alphanumeric')
        with Session(self.browser) as session:
            self.products.search(product.name).click()
            make_repository(
                session,
                name=repo_name,
                url=FAKE_YUM_SRPM_REPO,
            )
            self.assertIsNotNone(self.repository.search(repo_name))
            self.setup_navigate_syncnow(
                session,
                product.name,
                repo_name,
            )
            self.assertTrue(self.prd_sync_is_ok(repo_name))

            make_contentview(session, org=self.session_org.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))
        result = ssh.command(
            'ls /var/lib/pulp/published/yum/https/repos/{}/content_views/{}'
            '/1.0/custom/{}/{}/ | grep .src.rpm'.format(
                self.session_org.label,
                cv_name,
                product.label,
                repo_name,
            ))
        self.assertEqual(result.return_code, 0)
        self.assertGreaterEqual(len(result.stdout), 1)
Example #34
0
    def test_negative_update_description(self):
        """@test: Try to update content views description to invalid one.

        @feature: Content Views

        @assert: Content View is not updated. Appropriate error shown.
        """
        name = gen_string('alpha', 8)
        desc = gen_string('alpha', 15)
        new_description = gen_string('alpha', 256)
        with Session(self.browser) as session:
            make_contentview(session, org=self.organization.name,
                             name=name, description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_description=new_description)
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.error']))
Example #35
0
    def test_cv_promote_rh_1(self):
        """@test: attempt to promote a content view containing RH content

        @feature: Content Views

        @setup: Multiple environments for an org; RH content synced

        @assert: Content view can be promoted

        """
        cv_name = gen_string("alpha", 8)
        rh_repo = {
            'name': ("Red Hat Enterprise Linux 6 Server "
                     "- RH Common RPMs x86_64 6.3"),
            'product': "Red Hat Enterprise Linux Server",
            'reposet': ("Red Hat Enterprise Linux 6 Server "
                        "- RH Common (RPMs)"),
            'basearch': "x86_64",
            'releasever': "6.3"
        }
        env_name = gen_string("alpha", 8)
        publish_version = "Version 1"
        strategy, value = locators["content_env.select_name"]
        # Create new org to import manifest
        org_attrs = entities.Organization().create_json()
        org_id = org_attrs['id']
        org_name = org_attrs['name']
        with Session(self.browser) as session:
            make_lifecycle_environment(session, org=org_name,
                                       name=env_name)
            self.assertIsNotNone(session.nav.wait_until_element
                                 ((strategy, value % env_name)))
            self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id)
            # Create content-view
            make_contentview(session, org=org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [rh_repo['name']])
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
            self.content_views.publish(cv_name)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
            self.content_views.promote(cv_name, publish_version, env_name)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
Example #36
0
    def test_positive_delete(self):
        """@test: Delete content views

        @feature: Content Views

        @assert: Content view can be deleted and no longer appears in UI
        """
        with Session(self.browser) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_contentview(
                        session, org=self.organization.name, name=name)
                    self.assertIsNotNone(
                        self.content_views.search(name),
                        'Failed to find content view %s from %s org' % (
                            name, self.organization.name)
                    )
                    self.content_views.delete(name)
Example #37
0
    def test_cv_end_2_end(self):
        """@test: create content view with yum repo, publish it
        and promote it to Library +1 env

        @feature: Content Views

        @steps:
        1. Create Product/repo and Sync it
        2. Create CV and add created repo in step1
        3. Publish and promote it to 'Library'
        4. Promote it to next environment

        @assert: content view is created, updated with repo publish and
        promoted to next selected env

        """

        repo_name = gen_string("alpha", 8)
        env_name = gen_string("alpha", 8)
        cv_name = gen_string("alpha", 8)
        publish_version = "Version 1"
        strategy, value = locators["content_env.select_name"]
        with Session(self.browser) as session:
            # Create Life-cycle environment
            make_lifecycle_environment(session, org=self.org_name,
                                       name=env_name)
            self.assertIsNotNone(session.nav.wait_until_element
                                 ((strategy, value % env_name)))
            # Creates a CV along with product and sync'ed repository
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            # Add repository to selected CV
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
            # Publish and promote CV to next environment
            self.content_views.publish(cv_name)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
            self.content_views.promote(cv_name, publish_version, env_name)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
Example #38
0
    def test_positive_add_custom_content(self):
        """@test: associate custom content in a view

        @feature: Content Views

        @setup: Sync custom content

        @assert: Custom content can be seen in a view
        """
        cv_name = gen_string('alpha')
        repo_name = gen_string('alpha')
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(self.content_views.wait_until_element(
                common_locators['alert.success']))
Example #39
0
    def test_positive_cv_update_name(self, new_name):
        """@test: Positive update content views - name.

        @feature: Content Views

        @assert: edited content view save is successful and info is
        updated

        """
        name = gen_string("alpha", 8)
        desc = gen_string("alpha", 15)
        with Session(self.browser) as session:
            make_contentview(session,
                             org=self.org_name,
                             name=name,
                             description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_name)
            self.assertIsNotNone(self.content_views.search(new_name))
Example #40
0
    def test_positive_add_puppet_module(self):
        """Promote content view with puppet module to a new environment

        :id: 12bed99d-8f96-48ca-843a-b77e123e8e2e

        :steps:
            1. Create Product/puppet repo and sync it
            2. Create CV and add puppet module from created repo
            3. Publish and promote CV to new environment

        :expectedresults: Puppet modules can be listed successfully from
            lifecycle environment interface

        :BZ: 1408264

        :CaseLevel: Integration
        """
        cv_name = gen_string('alpha')
        env_name = gen_string('alpha')
        puppet_module = 'httpd'
        product = entities.Product(organization=self.organization).create()
        repo_id = entities.Repository(product=product,
                                      content_type=REPO_TYPE['puppet'],
                                      url=FAKE_0_PUPPET_REPO).create().id
        entities.Repository(id=repo_id).sync()
        with Session(self) as session:
            make_lifecycle_environment(session,
                                       org=self.organization.name,
                                       name=env_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_puppet_module(
                cv_name,
                puppet_module,
                filter_term='Latest',
            )
            self.content_views.publish(cv_name)
            self.content_views.promote(cv_name, 'Version 1', env_name)
            self.assertIsNotNone(
                self.lifecycleenvironment.fetch_puppet_module(env_name,
                                                              puppet_module,
                                                              cv_name=cv_name))
Example #41
0
    def test_positive_cv_update_description(self, new_description):
        """@test: Positive update content views - description.

        @feature: Content Views

        @assert: edited content view save is successful and info is
        updated

        """

        name = gen_string("alpha", 8)
        desc = gen_string("alpha", 15)
        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name,
                             name=name, description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_description=new_description)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.success"]))
Example #42
0
    def test_positive_create_with_name(self):
        """Create content views using different names

        :id: 804e51d7-f025-4ec2-a247-834afd351e89

        :expectedresults: Content views are created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_contentview(
                        session, org=self.organization.name, name=name)
                    self.assertIsNotNone(
                        self.content_views.search(name),
                        'Failed to find content view %s from %s org' % (
                            name, self.organization.name)
                    )
Example #43
0
    def test_negative_cv_update_description(self):
        """@test: Negative update content views - description.

        @feature: Content Views

        @assert: Content View is not updated,  Appropriate error shown.

        """

        name = gen_string("alpha", 8)
        desc = gen_string("alpha", 15)
        new_description = gen_string("alpha", 256)
        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name,
                             name=name, description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_description=new_description)
            self.assertIsNotNone(self.content_views.wait_until_element
                                 (common_locators["alert.error"]))
    def test_positive_create_with_name(self):
        """Create content views using different names

        :id: 804e51d7-f025-4ec2-a247-834afd351e89

        :expectedresults: Content views are created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_contentview(session,
                                     org=self.organization.name,
                                     name=name)
                    self.assertIsNotNone(
                        self.content_views.search(name),
                        'Failed to find content view %s from %s org' %
                        (name, self.organization.name))
    def test_positive_add_puppet_module(self):
        """Promote content view with puppet module to a new environment

        :id: 12bed99d-8f96-48ca-843a-b77e123e8e2e

        :steps:
            1. Create Product/puppet repo and sync it
            2. Create CV and add puppet module from created repo
            3. Publish and promote CV to new environment

        :expectedresults: Puppet modules can be listed successfully from
            lifecycle environment interface

        :BZ: 1408264

        :CaseLevel: Integration
        """
        cv_name = gen_string('alpha')
        env_name = gen_string('alpha')
        puppet_module = 'httpd'
        product = entities.Product(organization=self.organization).create()
        repo_id = entities.Repository(
            product=product,
            content_type=REPO_TYPE['puppet'],
            url=FAKE_0_PUPPET_REPO
        ).create().id
        entities.Repository(id=repo_id).sync()
        with Session(self) as session:
            make_lifecycle_environment(
                session, org=self.organization.name, name=env_name)
            # Create content-view
            make_contentview(session, org=self.organization.name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_puppet_module(
                cv_name,
                puppet_module,
                filter_term='Latest',
            )
            self.content_views.publish(cv_name)
            self.content_views.promote(cv_name, 'Version 1', env_name)
            self.assertIsNotNone(self.lifecycleenvironment.fetch_puppet_module(
                env_name, puppet_module, cv_name=cv_name))
Example #46
0
    def test_remove_filter(self):
        """@test: create empty content views filter and remove it(positive)

        @feature: Content Views

        @assert: content views filter removed successfully

        """
        cv_name = gen_string("alpha", 8)
        filter_name = gen_string("alpha", 8)
        content_type = FILTER_CONTENT_TYPE['package']
        filter_type = FILTER_TYPE['exclude']
        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_filter(cv_name, filter_name, content_type,
                                          filter_type)
            self.content_views.remove_filter(cv_name, [filter_name])
            self.assertIsNone(
                self.content_views.search_filter(cv_name, filter_name))
Example #47
0
    def test_negative_update_name(self):
        """@test: Try to update content views name to invalid one.

        @feature: Content Views

        @assert: Content View is not updated. Appropriate error shown.
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_contentview(
                session, org=self.organization.name, name=name)
            self.assertIsNotNone(self.content_views.search(name))
            # invalid_names_list is used instead of invalid_values_list
            # because save button will not be enabled if name is blank
            for new_name in invalid_names_list():
                with self.subTest(new_name):
                    self.content_views.update(name, new_name)
                    self.assertIsNotNone(self.content_views.wait_until_element(
                        common_locators['alert.error']))
                    self.assertIsNone(self.content_views.search(new_name))
Example #48
0
    def test_cv_create_negative(self, name):
        # variations (subject to change):
        # zero length, symbols, html, etc.
        """@test: create content views (negative)

        @feature: Content Views

        @assert: content views are not created; proper error thrown and
        system handles it gracefully

        """
        with Session(self.browser) as session:
            make_contentview(
                session, org=self.organization.name, name=name)
            self.assertTrue(
                self.content_views.wait_until_element(
                    locators['contentviews.has_error']),
                'No validation error found for "%s" from %s org' % (
                    name, self.organization.name))
            self.assertIsNone(self.content_views.search(name))
    def test_positive_delete(self):
        """Delete content views

        :id: bcea6ef0-bc25-4cc7-9c0c-3591bb8810e5

        :expectedresults: Content view can be deleted and no longer appears in
            UI

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_contentview(session,
                                     org=self.organization.name,
                                     name=name)
                    self.assertIsNotNone(
                        self.content_views.search(name),
                        'Failed to find content view %s from %s org' %
                        (name, self.organization.name))
                    self.content_views.delete(name)
Example #50
0
    def test_cv_create_negative(self, name):
        # variations (subject to change):
        # zero length, symbols, html, etc.
        """@test: create content views (negative)

        @feature: Content Views

        @assert: content views are not created; proper error thrown and
        system handles it gracefully

        @BZ: 1083086

        """

        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name, name=name)
            self.assertTrue(
                self.content_views.wait_until_element(
                    locators['contentviews.has_error']),
                'No validation error found for "%s" from %s org' %
                (name, self.org_name))
            self.assertIsNone(self.content_views.search(name))
Example #51
0
    def test_positive_cv_update_description(self, new_description):
        """@test: Positive update content views - description.

        @feature: Content Views

        @assert: edited content view save is successful and info is
        updated

        """

        name = gen_string("alpha", 8)
        desc = gen_string("alpha", 15)
        with Session(self.browser) as session:
            make_contentview(session,
                             org=self.org_name,
                             name=name,
                             description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_description=new_description)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
    def test_negative_update_name(self):
        """Try to update content views name to invalid one.

        :id: 211c319f-802a-4407-9c16-205a82d4afca

        :expectedresults: Content View is not updated. Appropriate error shown.

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_contentview(session, org=self.organization.name, name=name)
            self.assertIsNotNone(self.content_views.search(name))
            # invalid_names_list is used instead of invalid_values_list
            # because save button will not be enabled if name is blank
            for new_name in invalid_names_list():
                with self.subTest(new_name):
                    self.content_views.update(name, new_name)
                    self.assertIsNotNone(
                        self.content_views.wait_until_element(
                            common_locators['alert.error_sub_form']))
                    self.assertIsNone(self.content_views.search(new_name))
Example #53
0
    def test_negative_cv_update_description(self):
        """@test: Negative update content views - description.

        @feature: Content Views

        @assert: Content View is not updated,  Appropriate error shown.

        """

        name = gen_string("alpha", 8)
        desc = gen_string("alpha", 15)
        new_description = gen_string("alpha", 256)
        with Session(self.browser) as session:
            make_contentview(session,
                             org=self.org_name,
                             name=name,
                             description=desc)
            self.assertIsNotNone(self.content_views.search(name))
            self.content_views.update(name, new_description=new_description)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.error"]))
Example #54
0
    def test_associate_view_custom_content(self):
        """@test: associate custom content in a view

        @feature: Content Views

        @setup: Sync custom content

        @assert: Custom content can be seen in a view

        """

        cv_name = gen_string("alpha", 8)
        repo_name = gen_string("alpha", 8)
        with Session(self.browser) as session:
            self.setup_to_create_cv(repo_name=repo_name)
            # Create content-view
            make_contentview(session, org=self.org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            self.content_views.add_remove_repos(cv_name, [repo_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators["alert.success"]))
Example #55
0
    def test_cv_delete(self):
        """@test: delete content views

        @feature: Content Views

        @assert: edited content view can be deleted and no longer
        appears in any content view UI

        """

        name = gen_string('latin1', 8)

        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name, name=name)
            self.assertIsNotNone(
                self.content_views.search(name),
                'Failed to find content view %s from %s org' %
                (name, self.org_name))
            self.content_views.delete(name, True)
            self.assertIsNone(
                self.content_views.search(name),
                'Content view %s from %s org was not deleted' %
                (name, self.org_name))
Example #56
0
    def test_cv_associate_components_composite_negative(self):
        """@test: attempt to associate components to a non-composite
        content view

        @feature: Content Views

        @assert: User cannot add components to the view

        """

        cv1_name = gen_string("alpha", 8)
        cv2_name = gen_string("alpha", 8)
        with Session(self.browser) as session:
            make_contentview(session, org=self.org_name, name=cv1_name)
            self.assertIsNotNone(self.content_views.search(cv1_name))
            make_contentview(session, org=self.org_name, name=cv2_name)
            self.assertIsNotNone(self.content_views.search(cv2_name))
            with self.assertRaises(Exception) as context:
                self.content_views.add_remove_cv(cv1_name, [cv2_name])
            self.assertEqual(
                context.exception.message,
                'Could not find ContentView tab, Please '
                'make sure selected view is composite')
    def test_positive_update_name(self):
        """Update content views name to valid one.

        :id: 7d8eb36a-536e-49dc-9eb4-a5885ec77819

        :expectedresults: Content view is updated successfully and has proper
            name

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_contentview(
                session,
                org=self.organization.name,
                name=name,
                description=gen_string('alpha', 15),
            )
            self.assertIsNotNone(self.content_views.search(name))
            for new_name in valid_data_list():
                with self.subTest(new_name):
                    self.content_views.update(name, new_name)
                    self.assertIsNotNone(self.content_views.search(new_name))
                    name = new_name  # for next iteration
    def test_negative_create_with_invalid_name(self):
        """try to create content views using invalid names

        :id: 974f2adc-b7da-4a8c-a8b5-d231b6bda1ce

        :expectedresults: content views are not created; proper error thrown
            and system handles it gracefully

        :CaseImportance: Critical
        """
        with Session(self) as session:
            # invalid_names_list is used instead of invalid_values_list
            # because save button will not be enabled if name is blank
            for name in invalid_names_list():
                with self.subTest(name):
                    make_contentview(session,
                                     org=self.organization.name,
                                     name=name)
                    self.assertTrue(
                        self.content_views.wait_until_element(
                            locators['contentviews.has_error']),
                        'No validation error found for "%s" from %s org' %
                        (name, self.organization.name))
                    self.assertIsNone(self.content_views.search(name))
Example #59
0
    def test_end_to_end(self):
        """@Test: Perform end to end smoke tests using RH repos.

        @Feature: Smoke test

        @Assert: All tests should succeed and Content should be successfully
        fetched by client

        """
        org_name = gen_string("alpha", 6)
        cv_name = gen_string("alpha", 6)
        activation_key_name = gen_string("alpha", 6)
        env_name = gen_string("alpha", 6)
        product_name = "Red Hat Employee Subscription"
        repo_names = [
            "Red Hat Enterprise Virtualization Agents for RHEL 6 Server "
            "RPMs x86_64 6.5",
            "Red Hat Enterprise Virtualization Agents for RHEL 6 Server "
            "RPMs x86_64 6Server",
        ]
        repos = self.sync.create_repos_tree(RHVA_REPO_TREE)
        package_name = "python-kitchen"
        cloned_manifest_path = manifests.clone()
        # upload_file function should take care of uploading to sauce labs.
        upload_file(cloned_manifest_path, remote_file=cloned_manifest_path)
        with Session(self.browser) as session:
            # Create New organization
            make_org(session, org_name=org_name)
            self.assertIsNotNone(self.org.search(org_name))
            # Create New Lifecycle environment
            make_lifecycle_environment(session, org=org_name, name=env_name)
            strategy, value = locators["content_env.select_name"]
            self.assertIsNotNone(
                self.contentenv.wait_until_element(
                    (strategy, value % env_name)))
            # Navigate UI to select org and redhat subscription page
            session.nav.go_to_select_org(org_name)
            session.nav.go_to_red_hat_subscriptions()
            # Upload manifest from webui
            self.subscriptions.upload(cloned_manifest_path)
            self.assertTrue(
                session.nav.wait_until_element(
                    common_locators['alert.success']))
            session.nav.go_to_red_hat_repositories()
            # List of dictionary passed to enable the redhat repos
            # It selects Product->Reposet-> Repo
            self.sync.enable_rh_repos(repos)
            session.nav.go_to_sync_status()
            # Sync the repos
            sync = self.sync.sync_rh_repos(repos)
            # syn.sync_rh_repos returns boolean values and not objects
            self.assertTrue(sync)
            # Create new content-view
            make_contentview(session, org=org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))
            # Add YUM repository to content-view
            self.content_views.add_remove_repos(cv_name, repo_names)
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))
            # Publish content-view
            self.content_views.publish(cv_name)
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))

            # Promote content-view to life-cycle environment 1
            self.content_views.promote(cv_name,
                                       version="Version 1",
                                       env=env_name)
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))
            # Create Activation-Key
            make_activationkey(session,
                               org=org_name,
                               name=activation_key_name,
                               env=env_name,
                               content_view=cv_name)
            self.activationkey.associate_product(activation_key_name,
                                                 [product_name])
            self.activationkey.enable_repos(activation_key_name,
                                            [REPOSET['rhva6']])
            if not bz_bug_is_open(1191541):
                self.assertIsNotNone(
                    self.activationkey.wait_until_element(
                        common_locators["alert.success"]))
            # Create VM
            with VirtualMachine(distro='rhel66') as vm:
                # Download and Install rpm
                result = vm.run(
                    "wget -nd -r -l1 --no-parent -A '*.noarch.rpm' "
                    "http://{0}/pub/".format(self.server_name))
                self.assertEqual(
                    result.return_code, 0,
                    "failed to fetch katello-ca rpm: {0}, return code: {1}".
                    format(result.stderr, result.return_code))
                result = vm.run('rpm -i katello-ca-consumer*.noarch.rpm')
                self.assertEqual(
                    result.return_code, 0,
                    "failed to install katello-ca rpm: {0}, return code: {1}".
                    format(result.stderr, result.return_code))
                # Register client with foreman server using activation-key
                result = vm.run(
                    'subscription-manager register --activationkey {0} '
                    '--org {1} --force'.format(activation_key_name, org_name))
                self.assertEqual(
                    result.return_code, 0,
                    "failed to register client:: {0} and return code: {1}".
                    format(result.stderr, result.return_code))
                # Install contents from sat6 server
                result = vm.run('yum install -y {0}'.format(package_name))
                self.assertEqual(
                    result.return_code, 0,
                    "Package install failed: {0} and return code: {1}".format(
                        result.stderr, result.return_code))
                # Verify if package is installed by query it
                result = vm.run('rpm -q {0}'.format(package_name))
                self.assertIn(package_name, result.stdout[0])
Example #60
0
    def test_smoke(self):
        """@Test: Check that basic content can be created

        * Create a new user with admin permissions
        * Using the new user from above:

            * Create a new organization
            * Create two new lifecycle environments
            * Create a custom product
            * Create a custom YUM repository
            * Create a custom PUPPET repository
            * Synchronize both custom repositories
            * Create a new content view
            * Associate both repositories to new content view
            * Publish content view
            * Promote content view to both lifecycles
            * Create a new libvirt compute resource
            * Create a new subnet
            * Create a new domain
            * Create a new hostgroup and associate previous entities to it

        @Feature: Smoke Test

        @Assert: All entities are created and associated.

        """
        user_name = gen_string("alpha", 6)
        password = gen_string("alpha", 6)
        org_name = gen_string("alpha", 6)
        env_1_name = gen_string("alpha", 6)
        env_2_name = gen_string("alpha", 6)
        product_name = gen_string("alpha", 6)
        yum_repository_name = gen_string("alpha", 6)
        puppet_repository_name = gen_string("alpha", 6)
        cv_name = gen_string("alpha", 6)
        puppet_module = "httpd"
        module_ver = 'Latest'
        compute_resource_name = gen_string("alpha", 6)
        libvirt_url = "qemu+tcp://%s:16509/system"
        provider_type = FOREMAN_PROVIDERS['libvirt']
        url = (libvirt_url % conf.properties['main.server.hostname'])
        subnet_name = gen_string("alpha", 6)
        domain_name = gen_string("alpha", 6)
        domain = description = DOMAIN % domain_name
        hostgroup_name = gen_string("alpha", 6)

        # Create new user with admin permissions
        with Session(self.browser) as session:
            make_user(session,
                      username=user_name,
                      password1=password,
                      password2=password)
            self.assertIsNotNone(self.user.search(user_name, "login"))
            is_admin_role_selected = self.user.admin_role_to_user(user_name)
            self.assertTrue(is_admin_role_selected)

        # FIX ME: UI doesn't authenticate user created via UI auto: Issue #1152
        # Once #1152 is fixed; need to pass user_name and password to Session
        with Session(self.browser) as session:
            # Create New organization
            make_org(session, org_name=org_name)
            self.assertIsNotNone(self.org.search(org_name))

            # Create New Lifecycle environment1
            make_lifecycle_environment(session, org=org_name, name=env_1_name)
            strategy, value = locators["content_env.select_name"]
            self.assertIsNotNone(
                self.contentenv.wait_until_element(
                    (strategy, value % env_1_name)))
            # Create New  Lifecycle environment2
            make_lifecycle_environment(session,
                                       org=org_name,
                                       name=env_2_name,
                                       prior=env_1_name)
            self.assertIsNotNone(
                self.contentenv.wait_until_element(
                    (strategy, value % env_2_name)))

            # Create custom product
            make_product(session, org=org_name, name=product_name)
            self.assertIsNotNone(self.products.search(product_name))

            # Create a YUM repository
            make_repository(session,
                            org=org_name,
                            name=yum_repository_name,
                            product=product_name,
                            url=GOOGLE_CHROME_REPO)
            self.assertIsNotNone(self.repository.search(yum_repository_name))

            # Create a puppet Repository
            make_repository(session,
                            org=org_name,
                            name=puppet_repository_name,
                            product=product_name,
                            url=FAKE_0_PUPPET_REPO,
                            repo_type=REPO_TYPE['puppet'])
            self.assertIsNotNone(
                self.repository.search(puppet_repository_name))

            # Sync YUM and puppet repository
            self.navigator.go_to_sync_status()
            sync = self.sync.sync_custom_repos(
                product_name, [yum_repository_name, puppet_repository_name])
            self.assertIsNotNone(sync)

            # Create new content-view
            make_contentview(session, org=org_name, name=cv_name)
            self.assertIsNotNone(self.content_views.search(cv_name))

            # Add YUM repository to content-view
            self.content_views.add_remove_repos(cv_name, [yum_repository_name])
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))
            # Add puppet-module to content-view
            self.content_views.add_puppet_module(cv_name,
                                                 puppet_module,
                                                 filter_term=module_ver)

            # Publish content-view
            self.content_views.publish(cv_name)
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))
            # Promote content-view to life-cycle environment 1
            self.content_views.promote(cv_name,
                                       version="Version 1",
                                       env=env_1_name)
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))
            # Promote content-view to life-cycle environment 2
            self.content_views.promote(cv_name,
                                       version="Version 1",
                                       env=env_2_name)
            if not bz_bug_is_open(1191422):
                self.assertIsNotNone(
                    self.content_views.wait_until_element(
                        common_locators["alert.success"]))
            # Create a new libvirt compute resource
            make_resource(session,
                          org=org_name,
                          name=compute_resource_name,
                          provider_type=provider_type,
                          url=url)
            self.assertIsNotNone(
                self.compute_resource.search(compute_resource_name))

            # Create a subnet
            make_subnet(session,
                        org=org_name,
                        subnet_name=subnet_name,
                        subnet_network=gen_ipaddr(ip3=True),
                        subnet_mask="255.255.255.0")
            self.assertIsNotNone(self.subnet.search_subnet(subnet_name))

            # Create a Domain
            make_domain(session,
                        org=org_name,
                        name=domain,
                        description=description)
            self.assertIsNotNone(self.domain.search(description))

            # Create a HostGroup
            make_hostgroup(session, name=hostgroup_name)
            self.assertIsNotNone(self.hostgroup.search(hostgroup_name))