Example #1
0
    def test_positive_create_with_activation_keys(self):
        """Create new hostgroup with activation keys

        :id: cfda3c1b-37fd-42c1-a74c-841efb83b2f5

        :expectedresults: Hostgroup is created with activation keys

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_hostgroup(
                session,
                name=name,
                org=self.organization.name,
                parameters_list=[
                    ['Host Group', 'Lifecycle Environment', self.env.name],
                    ['Host Group', 'Content View', self.cv.name],
                    ['Activation Keys', 'Activation Keys', self.ak.name],
                ],
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Example #2
0
    def test_positive_create_with_auto_populated_label(self):
        """Create organization with valid name. Check that organization
        label is auto-populated

        :id: 29793945-c553-4a6e-881f-cdcde373aa62

        :expectedresults: organization is created, label is auto-generated

        :BZ: 1079482

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for org_name in generate_strings_list():
                with self.subTest(org_name):
                    make_org(session, org_name=org_name)
                    self.assertIsNotNone(self.org.search(org_name))
                    self.org.search_and_click(org_name)
                    label = session.nav.wait_until_element(
                        locators['org.label'])
                    label_value = label.get_attribute('value')
                    self.assertIsNotNone(label_value)
Example #3
0
    def test_positive_update_user(self):
        """Update usergroup with new user

        :id: 5fdb1c36-196d-4ba5-898d-40f484b81090

        :expectedresults: Usergroup is updated

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        user_name = gen_string('alpha')
        # Create a new user
        entities.User(
            login=user_name,
            password=gen_string('alpha'),
            organization=[self.organization],
        ).create()
        with Session(self.browser) as session:
            make_usergroup(session, name=name, org=self.organization.name)
            self.assertIsNotNone(self.usergroup.search(name))
            self.usergroup.update(name, users=[user_name])
            self.assertIsNotNone(self.usergroup.search(name))
Example #4
0
    def test_positive_delete_for_imported_content(self):
        """Create gpg key with valid name and valid gpg key via file import
        then delete it

        :id: 495547c0-8e38-49cc-9be4-3f24a20d3af7

        :expectedresults: gpg key is deleted

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_gpgkey(
                        session,
                        key_path=self.key_path,
                        name=name,
                        org=self.organization.name,
                        upload_key=True,
                    )
                    self.assertIsNotNone(self.gpgkey.search(name))
                    self.gpgkey.delete(name)
Example #5
0
    def test_create_resource_negative_2(self, description):
        """@Test: Create libvirt Compute Resource with 256 char description.

        @Feature: Compute Resource - Create with long description.

        @Assert: A libvirt Compute Resource is not created with 256 char
        description.

        """
        name = gen_string("alpha", 8)
        libvirt_url = "qemu+tcp://%s:16509/system"
        provider_type = FOREMAN_PROVIDERS['libvirt']
        url = (libvirt_url % conf.properties['main.server.hostname'])
        with Session(self.browser) as session:
            make_resource(session,
                          name=name,
                          description=description,
                          provider_type=provider_type,
                          url=url)
            error_element = session.nav.wait_until_element(
                common_locators["haserror"])
            self.assertIsNotNone(error_element)
Example #6
0
    def test_positive_discover_repo_via_new_product(self):
        """Create repository via repo discovery under new product

        @id: dc5281f8-1a8a-4a17-b746-728f344a1504

        @Assert: Repository is discovered and created

        @CaseLevel: Integration
        """
        product_name = gen_string('alpha')
        discovered_urls = 'fakerepo01/'
        with Session(self.browser) as session:
            session.nav.go_to_select_org(self.organization.name)
            session.nav.go_to_select_loc(self.loc.name)
            session.nav.go_to_products()
            self.repository.discover_repo(
                url_to_discover=REPO_DISCOVERY_URL,
                discovered_urls=[discovered_urls],
                product=product_name,
                new_product=True,
            )
            self.assertIsNotNone(self.products.search(product_name))
Example #7
0
    def test_positive_delete(self):
        """Create Activation key and delete it for all variations of
        Activation key name

        :id: 113e4c1e-cf4d-4c6a-88c9-766db8271933

        :expectedresults: Activation key is deleted

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in valid_data_list():
                with self.subTest(name):
                    make_activationkey(
                        session,
                        org=self.organization.name,
                        name=name,
                        env=ENVIRONMENT,
                        description=gen_string('utf8'),
                    )
                    self.assertIsNotNone(self.activationkey.search(name))
                    self.activationkey.delete(name)
Example #8
0
    def test_positive_list(self):
        """View all errata in an Org

        :id: 71c7a054-a644-4c1e-b304-6bc34ea143f4

        :Setup: Errata synced on satellite server.

        :Steps: Create two Orgs each having a product synced which contains
            errata.

        :expectedresults: Check that the errata belonging to one Org is not
            showing in the other.

        :CaseLevel: Integration
        """
        org = entities.Organization().create()
        env = entities.LifecycleEnvironment(organization=org).create()
        content_view = entities.ContentView(organization=org).create()
        activation_key = entities.ActivationKey(
            environment=env,
            organization=org,
        ).create()
        setup_org_for_a_custom_repo({
            'url': FAKE_3_YUM_REPO,
            'organization-id': org.id,
            'content-view-id': content_view.id,
            'lifecycle-environment-id': env.id,
            'activationkey-id': activation_key.id,
        })
        with Session(self) as session:
            session.nav.go_to_errata()
            self.errata.show_only_applicable(False)
            self.assertIsNone(self.errata.search(FAKE_3_ERRATA_ID))
            self.assertIsNotNone(self.errata.search(CUSTOM_REPO_ERRATA_ID))
            session.nav.go_to_select_org(org.name)
            session.nav.go_to_errata()
            self.errata.show_only_applicable(False)
            self.assertIsNone(self.errata.search(CUSTOM_REPO_ERRATA_ID))
            self.assertIsNotNone(self.errata.search(FAKE_3_ERRATA_ID))
Example #9
0
    def test_positive_list_permission(self):
        """Show errata only if the User has permissions to view them

        :id: cdb28f6a-23df-47a2-88ab-cd3b492126b2

        :Setup:

            1. Create two products with one repo each. Sync them.
            2. Make sure that they both have errata.
            3. Create a user with view access on one product and not on the
                other.

        :Steps: Go to Content -> Errata.

        :expectedresults: Check that the new user is able to see errata for one
            product only.

        :CaseLevel: Integration
        """
        role = entities.Role().create()
        entities.Filter(
            organization=[self.session_org],
            permission=entities.Permission(
                resource_type='Katello::Product').search(),
            role=role,
            search='name = "{0}"'.format(PRDS['rhel']),
        ).create()
        user_password = gen_string('alphanumeric')
        user = entities.User(
            default_organization=self.session_org,
            organization=[self.session_org],
            role=[role],
            password=user_password,
        ).create()
        with Session(self, user.login, user_password) as session:
            session.nav.go_to_errata()
            self.errata.show_only_applicable(False)
            self.assertIsNotNone(self.errata.search(REAL_0_ERRATA_ID))
            self.assertIsNone(self.errata.search(CUSTOM_REPO_ERRATA_ID))
Example #10
0
    def test_positive_delete_content_host(self):
        """Unregister and delete a host from content-hosts page

        :id: 3c75c1e6-85e3-49e6-a10e-6052a0db2b7f

        :steps:
            1.  Un-register and delete a host from content-host page
            2.  View host under content hosts
            3.  View host under 'All hosts'

        :expectedresults: Hosts un-registered from content-host should
            disappear from both sides of UI

        :CaseLevel: System
        """
        org = entities.Organization().create()
        env = entities.LifecycleEnvironment(organization=org).create()
        content_view = entities.ContentView(organization=org).create()
        activation_key = entities.ActivationKey(
            environment=env,
            organization=org,
        ).create()
        setup_org_for_a_rh_repo({
            'product': PRDS['rhel'],
            'repository-set': REPOSET['rhst7'],
            'repository': REPOS['rhst7']['name'],
            'organization-id': org.id,
            'content-view-id': content_view.id,
            'lifecycle-environment-id': env.id,
            'activationkey-id': activation_key.id,
        })
        with VirtualMachine(distro=DISTRO_RHEL7) as vm:
            vm.install_katello_ca()
            vm.register_contenthost(org.label, activation_key.name)
            self.assertTrue(vm.subscribed)
            with Session(self) as session:
                session.nav.go_to_select_org(org.name)
                self.contenthost.delete(vm.hostname)
                self.assertIsNone(self.hosts.search(vm.hostname))
Example #11
0
    def test_positive_register_host_via_ak(self):
        """Register a pre-installed host via rhsm using activation-key

        :id: b42a1a13-49ef-418e-bb66-12ed71cf3038

        :steps:
            1.  Register a host via rhsm using activation-key
            2.  View host under content hosts
            3.  View host under 'All Hosts'

        :expectedresults: Hosts registered via activation key appears under
            'All hosts' as well as under content-hosts

        :CaseLevel: System
        """
        org = entities.Organization().create()
        env = entities.LifecycleEnvironment(organization=org).create()
        content_view = entities.ContentView(organization=org).create()
        activation_key = entities.ActivationKey(
            environment=env,
            organization=org,
        ).create()
        setup_org_for_a_rh_repo({
            'product': PRDS['rhel'],
            'repository-set': REPOSET['rhst7'],
            'repository': REPOS['rhst7']['name'],
            'organization-id': org.id,
            'content-view-id': content_view.id,
            'lifecycle-environment-id': env.id,
            'activationkey-id': activation_key.id,
        })
        with VirtualMachine(distro=DISTRO_RHEL7) as vm:
            vm.install_katello_ca()
            vm.register_contenthost(org.label, activation_key.name)
            self.assertTrue(vm.subscribed)
            with Session(self) as session:
                session.nav.go_to_select_org(org.name)
                self.assertIsNotNone(self.hosts.search(vm.hostname))
                self.assertIsNotNone(self.contenthost.search(vm.hostname))
Example #12
0
    def test_positive_remove_hostgroup(self):
        """Add a hostgroup and remove it by using the organization
        name and hostgroup name.

        @id: 12e2fc40-d721-4e71-af7c-3db67b9e718e

        @assert: hostgroup is added to organization then removed.

        @CaseLevel: Integration
        """
        strategy, value = common_locators['entity_select']
        strategy1, value1 = common_locators['entity_deselect']
        with Session(self.browser) as session:
            for host_grp_name in generate_strings_list():
                with self.subTest(host_grp_name):
                    org_name = gen_string('alpha')
                    # Create hostgroup using nailgun
                    host_grp = entities.HostGroup(name=host_grp_name).create()
                    self.assertEqual(host_grp.name, host_grp_name)
                    make_org(session,
                             org_name=org_name,
                             hostgroups=[host_grp_name])
                    self.org.search(org_name).click()
                    session.nav.click(tab_locators['context.tab_hostgrps'])
                    element = session.nav.wait_until_element(
                        (strategy1, value1 % host_grp_name))
                    # Item is listed in 'Selected Items' list and not
                    # 'All Items' list.
                    self.assertIsNotNone(element)
                    self.org.update(org_name,
                                    hostgroups=[host_grp_name],
                                    new_hostgroups=None)
                    self.org.search(org_name).click()
                    session.nav.click(tab_locators['context.tab_hostgrps'])
                    element = session.nav.wait_until_element(
                        (strategy, value % host_grp_name))
                    # Item is listed in 'All Items' list and not
                    # Selected Items' list.
                    self.assertIsNotNone(element)
Example #13
0
    def test_positive_search_random(self):
        """Perform search on Dashboard using any random string

        :id: 28062a97-d642-41ac-b107-0b8a41eac478

        :Steps:

            1. Navigate to Monitor -> Dashboard
            2. Perform search using any random test string

        :BZ: 1391365

        :expectedresults: Check that we have zero as a result of search and any
            error is not raised

        :CaseImportance: Critical
        """
        with Session(self.browser) as session:
            set_context(session, org=ANY_CONTEXT['org'])
            self.assertEqual(self.dashboard.search(gen_string('alpha')), 0)
            self.assertIsNone(self.dashboard.wait_until_element(
                common_locators['alert.error'], timeout=3))
Example #14
0
    def test_positive_save(self):
        """Save the Dashboard UI

        :id: 0bd8560c-d612-49c7-83ee-558bbaa16bce

        :Steps:

            1. Navigate to Monitor -> Dashboard
            2. Try to remove some widgets
            3. Select the Manage Dropdown box
            4. Save the Dashboard

        :expectedresults: Dashboard is saved successfully and the removed
            widgets does not appear.

        :CaseImportance: Critical
        """
        with Session(self.browser):
            self.dashboard.remove_widget('Host Configuration Chart')
            self.dashboard.manage_widget('Save Dashboard')
            self.assertIsNone(
                self.dashboard.get_widget('Host Configuration Chart'))
Example #15
0
    def test_negative_create_with_invalid_name(self):
        """Create repository with invalid names

        @id: 385d0222-6466-4bc0-9686-b215f41e4274

        @Assert: Repository is not created
        """
        # Creates new product
        product = entities.Product(organization=self.organization).create()
        for repo_name in invalid_values_list(interface='ui'):
            with self.subTest(repo_name):
                with Session(self.browser) as session:
                    set_context(session, org=self.organization.name)
                    self.products.search(product.name).click()
                    make_repository(
                        session,
                        name=repo_name,
                        url=FAKE_1_YUM_REPO,
                    )
                    invalid = self.products.wait_until_element(
                        common_locators['common_invalid'])
                    self.assertIsNotNone(invalid)
Example #16
0
    def test_positive_preview_verify(self):
        """Use preview within the job template editor to verify template

        :id: 4b4939f3-c056-4716-8071-e8fa00233e3e

        :Steps:

            1. Create a new job template.
            2. Add input controls under jobs
            3. Reference those input controls in the template text
            4. Select "preview" within the template viewer

        :expectedresults: Verify no errors are thrown

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        var_name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alpha'),
                org=self.organization.name,
            )
            self.jobtemplate.add_input(name, var_name)
            self.jobtemplate.update(
                name,
                template_type='input',
                template_content='<%= input("{0}") %>'.format(var_name)
            )
            self.jobtemplate.click(self.jobtemplate.search(name))
            self.jobtemplate.click(common_locators['ace.preview'])
            self.assertEqual(
                u'$USER_INPUT[{0}]'.format(var_name),
                self.jobtemplate.wait_until_element(
                    locators['job.template_input']).text
            )
Example #17
0
    def test_positive_update_gpg(self):
        """Update content repository with new gpg-key

        @id: 51da6572-02d0-43d7-96cc-895b5bebfadb

        @Assert: Repository is updated with new gpg key
        """
        repo_name = gen_string('alphanumeric')
        key_1_content = read_data_file(VALID_GPG_KEY_FILE)
        key_2_content = read_data_file(VALID_GPG_KEY_BETA_FILE)
        # Create two new GPGKey's
        gpgkey_1 = entities.GPGKey(
            content=key_1_content,
            organization=self.organization,
        ).create()
        gpgkey_2 = entities.GPGKey(
            content=key_2_content,
            organization=self.organization,
        ).create()
        product = entities.Product(organization=self.organization).create()
        with Session(self.browser) as session:
            set_context(session, org=self.organization.name)
            self.products.search(product.name).click()
            make_repository(
                session,
                name=repo_name,
                url=FAKE_1_YUM_REPO,
                gpg_key=gpgkey_1.name,
            )
            self.assertIsNotNone(self.repository.search(repo_name))
            self.assertTrue(
                self.repository.validate_field(repo_name, 'gpgkey',
                                               gpgkey_1.name))
            self.products.search(product.name).click()
            self.repository.update(repo_name, new_gpg_key=gpgkey_2.name)
            self.products.search(product.name).click()
            self.assertTrue(
                self.repository.validate_field(repo_name, 'gpgkey',
                                               gpgkey_2.name))
Example #18
0
    def test_positive_preview_job_template_with_foreman_url(self):
        """Create a simple Job Template that contains foreman url variable in
        its body

        :id: 46f93efd-1508-41b6-af34-e9d7f658925b

        :Steps:

            1. Navigate to Hosts -> Job Templates
            2. Enter a valid name
            3. Populate the template code
            4. Navigate to the job tab
            5. Enter a job name
            6. Click submit
            7. Open created template and select "preview" within the template
                viewer

        :expectedresults: The job template content can be previewed without
            errors

        :BZ: 1374344

        :CaseImportance: Critical
        """
        template_name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=template_name,
                template_type='input',
                template_content='<%= foreman_url("built") %>',
            )
            self.jobtemplate.click(self.jobtemplate.search(template_name))
            self.jobtemplate.click(common_locators['ace.preview'])
            self.assertIn(
                settings.server.hostname,
                self.jobtemplate.wait_until_element(
                    locators['job.template_input']).text
            )
Example #19
0
    def test_positive_delete_custom_ostree_repo(self):
        """Delete custom ostree repository.

        @id: 87dcb236-4eb4-4897-9c2a-be1d0f4bc3e7

        @Assert: Delete custom ostree repository should be successful
        """
        prod = entities.Product(organization=self.organization).create()
        repo_name = gen_string('alphanumeric')
        # Creates new ostree repository using api
        entities.Repository(
            name=repo_name,
            content_type='ostree',
            url=FEDORA22_OSTREE_REPO,
            product=prod,
            unprotected=False,
        ).create()
        with Session(self.browser) as session:
            session.nav.go_to_select_org(self.organization.name)
            self.products.click(self.products.search(prod.name))
            self.assertIsNotNone(self.repository.search(repo_name))
            self.repository.delete(repo_name)
Example #20
0
    def test_negative_set_parameter(self):
        """Set a parameter in a domain with 256 chars in name and value.

        @Feature: Domain - Misc.

        @Assert: Domain parameter is not updated.
        """
        name = gen_string('alpha', 4)
        domain_name = description = DOMAIN % name
        param_name = gen_string('alpha', 256)
        param_value = gen_string('alpha', 256)
        with Session(self.browser) as session:
            make_domain(session, name=domain_name, description=description)
            element = self.domain.search(description)
            self.assertIsNotNone(element)
            try:
                self.domain.set_domain_parameter(
                    description, param_name, param_value)
            except UIError as err:
                self.fail(err)
            self.assertIsNotNone(session.nav.wait_until_element(
                common_locators['common_param_error']))
Example #21
0
    def test_positive_create_with_oscap_capsule(self):
        """Create new hostgroup with oscap capsule

        :id: c0ab1148-93ff-41d3-93c3-2ff139349884

        :expectedresults: Hostgroup is created with oscap capsule

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_hostgroup(
                session,
                name=name,
                parameters_list=[
                    ['Host Group', 'Content Source', self.sat6_hostname],
                    ['Host Group', 'Puppet CA', self.sat6_hostname],
                    ['Host Group', 'Puppet Master', self.sat6_hostname],
                    ['Host Group', 'Openscap Capsule', self.sat6_hostname],
                ],
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Example #22
0
    def test_positive_enable_merge_overrides_default_checkboxes(self):
        """Enable Merge Overrides, Merge Default and Avoid Duplicates
        checkboxes for supported types.

        :id: d6323648-4720-4c33-b25f-2b2b569d9df0

        :steps:
            1.  Check the Override checkbox.
            2.  Set parameter type to array/hash.

        :expectedresults: The Merge Overrides, Merge Default and Avoid
            Duplicates checkboxes are enabled to check.
        """
        sc_param = self.sc_params_list.pop()
        with Session(self):
            self.sc_parameters.update(
                sc_param.parameter,
                self.puppet_class.name,
                override=True,
                default_value='[20]',
                key_type='array',
            )
            self.assertIsNone(
                self.sc_parameters.wait_until_element(
                    locators['sc_parameters.matcher_error'], timeout=5))
            self.sc_parameters.click(self.sc_parameters.search(
                sc_param.parameter, self.puppet_class.name))
            self.assertTrue(self.sc_parameters.is_element_enabled(
                locators['sc_parameters.merge_overrides']))
            self.assertFalse(self.sc_parameters.is_element_enabled(
                locators['sc_parameters.merge_default']))
            self.assertFalse(self.sc_parameters.is_element_enabled(
                locators['sc_parameters.avoid_duplicates']))
            self.sc_parameters.click(locators['sc_parameters.merge_overrides'])
            self.assertTrue(self.sc_parameters.is_element_enabled(
                locators['sc_parameters.merge_default']))
            self.assertTrue(self.sc_parameters.is_element_enabled(
                locators['sc_parameters.avoid_duplicates']))
Example #23
0
    def test_negative_preview_verify(self):
        """Use a template file to populate the job template

        :id: 8c0d132c-b500-44b5-a549-d32c7636a712

        :Steps:

            1. Create a new job template
            2. Add input controls under jobs
            3. Incorrectly reference those input controls in the template text
            4. And/or reference non-existent input controls in the template
               text
            5. Select "preview" within the template viewer

        :expectedresults: Verify appropriate errors are thrown

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alpha'),
                org=self.organization.name,
            )
            self.jobtemplate.add_input(name, gen_string('alpha'))
            self.jobtemplate.update(
                name,
                template_type='input',
                template_content='<%= input("{0}") %>'.format(
                    gen_string('alphanumeric')))
            self.jobtemplate.click(self.jobtemplate.search(name))
            self.jobtemplate.click(common_locators['ace.preview'])
            self.assertIsNotNone(
                self.jobtemplate.wait_until_element(
                    common_locators['alert.error']))
Example #24
0
    def test_negative_update_parameter_type(self):
        """Negative Parameter Update for parameter types - Invalid Value.

        Types - string, boolean, integer, real, array, hash, yaml, json

        :id: 4285b397-0426-4523-8cc2-8e5d79f49aae

        :steps:
            1.  Check the Override checkbox.
            2.  Update the Key Type.
            3.  Enter an 'Invalid' default Value.
            4.  Submit the changes.

        :expectedresults: Parameter is not updated with invalid value for
            specific type.

        :CaseImportance: Critical
        """
        sc_param = self.sc_params_list.pop()
        with Session(self):
            initial_value = self.sc_parameters.fetch_default_value(
                sc_param.parameter, self.puppet_class.name)
            for data in invalid_sc_parameters_data():
                with self.subTest(data):
                    self.sc_parameters.update(
                        sc_param.parameter,
                        self.puppet_class.name,
                        override=True,
                        key_type=data['sc_type'],
                        default_value=data['value'],
                    )
                    self.assertIsNotNone(
                        self.sc_parameters.wait_until_element(
                            common_locators['haserror'])
                    )
                    value = self.sc_parameters.fetch_default_value(
                        sc_param.parameter, self.puppet_class.name)
                    self.assertEqual(value, initial_value)
Example #25
0
    def test_positive_create_matcher_puppet_default_value(self):
        """Create matcher for attribute in parameter, where Value is puppet
        default value.

        :id: 656f25cd-4394-414a-bd8e-458f0e51c668

        :steps:
            1.  Check the Override checkbox.
            2.  Set some default Value.
            3.  Click on 'Add Matcher' button to add matcher.
            4.  Choose valid attribute type, name and puppet default value.
            5.  Submit the change.

        :expectedresults: The matcher has been created successfully.

        :CaseImportance: Critical
        """
        sc_param = self.sc_params_list.pop()
        with Session(self):
            self.sc_parameters.update(
                sc_param.parameter,
                self.puppet_class.name,
                override=True,
                default_value=gen_integer(),
                key_type='integer',
                matcher=[{
                    'matcher_attribute': 'os=rhel6',
                    'matcher_value': '',
                    'matcher_omit': True
                }]
            )
            self.assertIsNone(
                self.sc_parameters.wait_until_element(
                    locators['sc_parameters.matcher_error'], timeout=5))
            self.sc_parameters.click(self.sc_parameters.search(
                sc_param.parameter, self.puppet_class.name))
            self.assertFalse(self.sc_parameters.is_element_enabled(
                locators['sc_parameters.matcher_value'] % 1))
Example #26
0
    def test_positive_provision_atomic_host(self):
        """Provision an atomic host on libvirt and register it with satellite

        :id: 5ddf2f7f-f7aa-4321-8717-372c7b6e99b6

        :expectedresults: Atomic host should be provisioned and listed under
            content-hosts/Hosts

        :CaseLevel: System
        """
        resource = u'{0} (Libvirt)'.format(self.computeresource.name)
        root_pwd = gen_string('alpha', 15)
        with Session(self) as session:
            make_host(
                session,
                name=self.hostname,
                org=self.org_name,
                loc=self.loc_name,
                force_context=True,
                parameters_list=[
                    ['Host', 'Organization', self.org_name],
                    ['Host', 'Location', self.loc_name],
                    ['Host', 'Host group', self.host_group.name],
                    ['Host', 'Deploy on', resource],
                    ['Virtual Machine', 'Memory', '1 GB'],
                    ['Operating System', 'Media', self.media.name],
                    ['Operating System', 'Partition table', DEFAULT_PTABLE],
                    ['Operating System', 'Root password', root_pwd],
                ],
                interface_parameters=[
                    ['Network type', 'Physical (Bridge)'],
                    ['Network', settings.vlan_networking.bridge],
                ],
            )
            search = self.hosts.search(
                u'{0}.{1}'.format(self.hostname, self.domain_name)
            )
            self.assertIsNotNone(search)
    def test_positive_create_date_filter_rule_without_type(self):
        """Create content view erratum filter rule with start/end date and
        without type specified via API and make sure it's accessible via UI

        :id: 5a5cd6e7-8711-47c2-878d-4c0a18bf3b0e

        :BZ: 1386688

        :CaseImportance: Critical

        :expectedresults: filter rule is accessible via UI, type is set to all
            possible errata types and all the rest fields are correctly
            populated
        """
        start_date = date.today().strftime('%Y-%m-%d')
        end_date = (date.today() + timedelta(days=5)).strftime('%Y-%m-%d')
        # default date type on UI is 'updated', so we'll use different one
        date_type = FILTER_ERRATA_DATE['issued']
        content_view = entities.ContentView(
            organization=self.organization).create()
        cvf = entities.ErratumContentViewFilter(
            content_view=content_view).create()
        cvfr = entities.ContentViewFilterRule(
            end_date=end_date,
            content_view_filter=cvf,
            date_type=date_type,
            start_date=start_date,
        ).create()
        self.assertEqual(set(cvfr.types), set(FILTER_ERRATA_TYPE.values()))
        with Session(self) as session:
            session.nav.go_to_select_org(self.organization.name)
            result = self.content_views.fetch_erratum_date_range_filter_values(
                content_view.name, cvf.name)
            self.assertEqual(set(result['types']),
                             set(FILTER_ERRATA_TYPE.values()))
            self.assertEqual(result['date_type'], date_type)
            self.assertEqual(result['start_date'], start_date)
            self.assertEqual(result['end_date'], end_date)
Example #28
0
    def test_negative_update_priority(self):
        """Update discovery rule priority using invalid values

        :id: d44ad49c-5d95-442f-a1b3-cd82dd8ffabf

        :expectedresults: Rule priority is not updated

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        priority = str(gen_integer(1, 100))
        with Session(self) as session:
            make_discoveryrule(
                session,
                name=name,
                hostgroup=self.host_group.name,
                priority=priority,
                locations=[self.session_loc.name],
            )
            self.assertIsNotNone(self.discoveryrules.search(name))
            for new_priority in '-1', gen_string('alpha'):
                with self.subTest(new_priority):
                    self.discoveryrules.update(
                        name=name, priority=new_priority)
                    msg = self.discoveryrules.find_element(
                        locators['discoveryrules.priority']
                    ).get_attribute("validationMessage")
                    if new_priority == '-1':
                        self.assertEqual(
                            msg,
                            u'Please select a value that is no less than 0.'
                        )
                    else:
                        self.assertEqual(msg, u'Please enter a number.')
            self.assertEqual(
                self.discoveryrules.get_attribute_value(name, 'priority'),
                priority
            )
Example #29
0
    def test_negative_update_limit(self):
        """Update discovery rule host limit using invalid values

        :id: 7e8b7218-3c8a-4b03-b0df-484e0d793ceb

        :expectedresults: Rule host limit is not updated

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        limit = str(gen_integer(1, 100))
        with Session(self) as session:
            make_discoveryrule(
                session,
                name=name,
                hostgroup=self.host_group.name,
                host_limit=limit,
                locations=[self.session_loc.name],
            )
            self.assertIsNotNone(self.discoveryrules.search(name))
            for new_limit in '-1', gen_string('alpha'):
                with self.subTest(new_limit):
                    self.discoveryrules.update(
                        name=name, host_limit=new_limit)
                    msg = self.discoveryrules.find_element(
                        locators['discoveryrules.host_limit']
                    ).get_attribute("validationMessage")
                    if new_limit == '-1':
                        self.assertEqual(
                            msg,
                            u'Please select a value that is no less than 0.'
                        )
                    else:
                        self.assertEqual(msg, u'Please enter a number.')
            self.assertEqual(
                self.discoveryrules.get_attribute_value(name, 'host_limit'),
                limit
            )
Example #30
0
    def test_positive_create_job_template_input(self):
        """Create a Job Template using input

        :id: dbaf5aa9-101d-47dc-bdf8-d5b4d1a52396

        :Steps:

            1. Navigate to Hosts -> Job Templates
            2. Enter a name
            3. Navigate to the job tab
            4. Enter a job name
            5. Click the +Add Input button
            6. Add an appropriate name
            7. Choose an input type
            8. Populate the template code and reference the newly created input
            9. Click submit

        :expectedresults: The job template was successfully saved with new
            input added

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        var_name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alphanumeric', 20),
            )
            self.assertIsNotNone(self.jobtemplate.search(name))
            self.jobtemplate.add_input(name, var_name)
            self.jobtemplate.update(
                name,
                template_type='input',
                template_content='<%= input("{0}") %>'.format(var_name)
            )