Exemplo n.º 1
0
    def test_positive_create_with_arch_and_os(self):
        """Create new hostgroup with architecture and operating system assigned

        :id: eaa91ddb-fce0-4284-88f8-c4d4367086c5

        :expectedresults: Hostgroup is created

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        arch = entities.Architecture().create()
        custom_os = entities.OperatingSystem(architecture=[arch]).create()
        with Session(self) as session:
            make_hostgroup(
                session,
                name=name,
                org=self.organization.name,
                parameters_list=[
                    ['Operating System', 'Architecture', arch.name],
                    [
                        'Operating System', 'Operating system',
                        '{0} {1}'.format(custom_os.name, custom_os.major)
                    ],
                ],
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 2
0
    def test_positive_create_with_arch_and_os(self):
        """Create new hostgroup with architecture and operating system assigned

        :id: eaa91ddb-fce0-4284-88f8-c4d4367086c5

        :expectedresults: Hostgroup is created

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        arch = entities.Architecture().create()
        custom_os = entities.OperatingSystem(
            architecture=[arch]).create()
        with Session(self) as session:
            make_hostgroup(
                session,
                name=name,
                org=self.organization.name,
                parameters_list=[
                    ['Operating System', 'Architecture', arch.name],
                    [
                        'Operating System',
                        'Operating system',
                        '{0} {1}'.format(custom_os.name, custom_os.major)
                    ],
                ],
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 3
0
    def test_remove_hostgroup_1(self, host_grp):
        """@test: Add a hostgroup and remove it by using the location
        name and hostgroup name

        @feature: Locations

        @assert: hostgroup is added to location then removed

        """
        strategy, value = common_locators["all_values_selection"]
        loc_name = generate_string("alpha", 8)
        with Session(self.browser) as session:
            make_hostgroup(session, name=host_grp)
            self.assertIsNotNone(self.hostgroup.search(host_grp))
            make_loc(session, name=loc_name, edit=True)
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_hostgrps"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % host_grp))
            # Item is listed in 'Selected Items' list and not 'All Items' list.
            self.assertIsNotNone(element)
            self.hostgroup.delete(host_grp, True)
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_hostgrps"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % host_grp))
            # Item is listed in 'All Items' list and not 'Selected Items' list.
            self.assertIsNone(element)
Exemplo n.º 4
0
    def test_remove_hostgroup_1(self, host_grp):
        """@test: Add a hostgroup and remove it by using the organization
        name and hostgroup name.

        @feature: Organizations remove hostgroup.

        @assert: hostgroup is added to organization then removed.

        """
        strategy, value = common_locators["entity_select"]
        strategy1, value1 = common_locators["entity_deselect"]
        org_name = generate_string("alpha", 8)
        with Session(self.browser) as session:
            make_hostgroup(session, name=host_grp)
            self.assertIsNotNone(self.hostgroup.search(host_grp))
            make_org(session, org_name=org_name, hostgroups=[host_grp],
                     edit=True)
            self.org.search(org_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_hostgrps"]).click()
            element = session.nav.wait_until_element((strategy1,
                                                      value1 % host_grp))
            # Item is listed in 'Selected Items' list and not 'All Items' list.
            self.assertIsNotNone(element)
            self.org.update(org_name, hostgroups=[host_grp],
                            new_hostgroups=None)
            self.org.search(org_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_hostgrps"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % host_grp))
            # Item is listed in 'All Items' list and not 'Selected Items' list.
            self.assertIsNotNone(element)
Exemplo n.º 5
0
    def test_positive_update_with_removed_arch(self):
        """Create new hostgroup with content view, architecture and os
        assigned. Then remove these attributes from the hostgroup. Attempt to
        update hostgroup with the same architecture

        :id: 431d88a3-590e-42cf-b45d-09b1d8a62b30

        :expectedresults: Hostgroup is updated and no error is raised

        :BZ: 1372917

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        arch = entities.Architecture().create()
        custom_os = entities.OperatingSystem(architecture=[arch]).create()
        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],
                    ['Operating System', 'Architecture', arch.name],
                    [
                        'Operating System', 'Operating system',
                        '{0} {1}'.format(custom_os.name, custom_os.major)
                    ],
                ],
            )
            self.hostgroup.search_and_click(name)
            self.hostgroup.click(
                tab_locators['hostgroup.tab_operating_system'])
            self.assertEqual(
                self.hostgroup.wait_until_element(
                    locators['hostgroups.architecture_value']).text, arch.name)
            self.hostgroup.update(
                name,
                parameters_list=[
                    ['Operating System', 'Operating system', None],
                    ['Operating System', 'Architecture', None],
                ],
            )
            self.hostgroup.search_and_click(name)
            self.hostgroup.click(
                tab_locators['hostgroup.tab_operating_system'])
            self.assertIsNone(
                self.hostgroup.wait_until_element(
                    locators['hostgroups.architecture_value'], timeout=5))
            self.hostgroup.update(
                name,
                parameters_list=[[
                    'Operating System', 'Architecture', arch.name
                ]],
            )
            self.assertIsNone(
                self.hostgroup.wait_until_element(common_locators['haserror'],
                                                  timeout=3))
Exemplo n.º 6
0
    def test_create_hostgroup(self, name):
        """
        @Test: Create new hostgroup
        @Feature: Hostgroup - Positive Create
        @Assert: Hostgroup is created
        """

        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 7
0
    def test_create_hostgroup(self, name):
        """@Test: Create new hostgroup

        @Feature: Hostgroup - Positive Create

        @Assert: Hostgroup is created

        """
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 8
0
    def test_negative_create_hostgroup_3(self, test_data):
        """
        @Test: Create new hostgroup with whitespaces in name
        @Feature: Hostgroup - Negative Create
        @Assert: Hostgroup is not created
        """

        with Session(self.browser) as session:
            make_hostgroup(session, name=test_data['name'])
            self.assertIsNotNone(self.hostgroup.wait_until_element
                                 (common_locators["name_haserror"]))
Exemplo n.º 9
0
    def test_delete_hostgroup(self, name):
        """@Test: Delete a hostgroup

        @Feature: Hostgroup - Positive Delete

        @Assert: Hostgroup is deleted

        """
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.hostgroup.delete(name)
Exemplo n.º 10
0
    def test_positive_delete(self):
        """Delete a hostgroup

        @id: f118532b-ca9b-4bf4-b53b-9573abcb347a

        @Assert: Hostgroup is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.hostgroup.delete(name)
Exemplo n.º 11
0
    def test_positive_create_with_name(self):
        """Create new hostgroup

        @id: 8bcf45e5-9e7f-4050-9de6-a90350b70006

        @Assert: Hostgroup is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 12
0
    def test_positive_delete(self):
        """Delete a hostgroup

        @Feature: Hostgroup - Positive Delete

        @Assert: Hostgroup is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.hostgroup.delete(name)
Exemplo n.º 13
0
    def test_delete_hostgroup(self, name):
        """
        @Test: Delete a hostgroup
        @Feature: Hostgroup - Positive Delete
        @Assert: Hostgroup is deleted
        """

        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            self.hostgroup.delete(name, really=True)
            self.assertIsNone(self.hostgroup.search(name))
Exemplo n.º 14
0
    def test_positive_delete(self):
        """Delete a hostgroup

        @id: f118532b-ca9b-4bf4-b53b-9573abcb347a

        @Assert: Hostgroup is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.hostgroup.delete(name)
Exemplo n.º 15
0
    def test_positive_create_with_name(self):
        """Create new hostgroup

        @id: 8bcf45e5-9e7f-4050-9de6-a90350b70006

        @Assert: Hostgroup is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 16
0
    def test_positive_create_with_name(self):
        """Create new hostgroup

        @Feature: Hostgroup - Positive Create

        @Assert: Hostgroup is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 17
0
    def test_positive_delete(self):
        """Delete a hostgroup

        @Feature: Hostgroup - Positive Delete

        @Assert: Hostgroup is deleted
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.hostgroup.delete(name)
Exemplo n.º 18
0
    def test_positive_create_with_name(self):
        """Create new hostgroup

        @Feature: Hostgroup - Positive Create

        @Assert: Hostgroup is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 19
0
    def test_negative_create_hostgroup_with_too_long_name(self, name):
        """@Test: Create new hostgroup with 256 chars in name

        @Feature: Hostgroup - Negative Create

        @Assert: Hostgroup is not created

        """
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.wait_until_element
                                 (common_locators['name_haserror']))
Exemplo n.º 20
0
    def test_negative_create_hostgroup_2(self, name):
        """
        @Test: Create new hostgroup with same name
        @Feature: Hostgroup - Negative Create
        @Assert: Hostgroup is not created
        """

        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.wait_until_element
                                 (common_locators["name_haserror"]))
Exemplo n.º 21
0
    def test_negative_create_hostgroup_1(self, name):
        """@Test: Create new hostgroup with 256 chars in name

        @Feature: Hostgroup - Negative Create

        @Assert: Hostgroup is not created

        """
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(
                self.hostgroup.wait_until_element(
                    common_locators["name_haserror"]))
Exemplo n.º 22
0
    def test_delete_hostgroup(self, name):
        """@Test: Delete a hostgroup

        @Feature: Hostgroup - Positive Delete

        @Assert: Hostgroup is deleted

        """
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            self.hostgroup.delete(name, really=True)
            self.assertIsNone(self.hostgroup.search(name))
Exemplo n.º 23
0
    def test_update_hostgroup(self, test_data):
        """
        @Test: Update hostgroup with a new name
        @Feature: Hostgroup - Positive Update
        @Assert: Hostgroup is updated
        """

        with Session(self.browser) as session:
            make_hostgroup(session, name=test_data['name'])
            self.assertIsNotNone(self.hostgroup.search(test_data['name']))
            self.hostgroup.update(test_data['name'],
                                  new_name=test_data['new_name'])
            self.assertIsNotNone(self.hostgroup.search(test_data['new_name']))
Exemplo n.º 24
0
    def test_negative_create_with_invalid_name(self):
        """Create new hostgroup with invalid names

        @Feature: Hostgroup - Negative Create

        @Assert: Hostgroup is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.wait_until_element
                                         (common_locators['name_haserror']))
Exemplo n.º 25
0
    def test_update_hostgroup(self, test_data):
        """@Test: Update hostgroup with a new name

        @Feature: Hostgroup - Positive Update

        @Assert: Hostgroup is updated

        """
        with Session(self.browser) as session:
            make_hostgroup(session, name=test_data['name'])
            self.assertIsNotNone(self.hostgroup.search(test_data['name']))
            self.hostgroup.update(test_data['name'],
                                  new_name=test_data['new_name'])
            self.assertIsNotNone(self.hostgroup.search(test_data['new_name']))
Exemplo n.º 26
0
    def test_positive_delete(self):
        """Delete a hostgroup

        :id: f118532b-ca9b-4bf4-b53b-9573abcb347a

        :expectedresults: Hostgroup is deleted

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.hostgroup.delete(name, dropdown_present=True)
Exemplo n.º 27
0
    def test_negative_create_with_same_name(self):
        """Create new hostgroup with same name

        @Feature: Hostgroup - Negative Create

        @Assert: Hostgroup is not created
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.wait_until_element
                                 (common_locators['name_haserror']))
Exemplo n.º 28
0
    def test_negative_create_with_same_name(self):
        """Create new hostgroup with same name

        @id: 237b684d-3b55-444a-be00-a9825952bb53

        @Assert: Hostgroup is not created
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.wait_until_element
                                 (common_locators['name_haserror']))
Exemplo n.º 29
0
    def test_negative_create_with_invalid_name(self):
        """Create new hostgroup with invalid names

        @Feature: Hostgroup - Negative Create

        @Assert: Hostgroup is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(
                        self.hostgroup.wait_until_element(
                            common_locators['name_haserror']))
Exemplo n.º 30
0
    def test_update_hostgroup(self, new_name):
        """@Test: Update hostgroup with a new name

        @Feature: Hostgroup - Positive Update

        @Assert: Hostgroup is updated

        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            self.hostgroup.update(name, new_name=new_name)
            self.assertIsNotNone(self.hostgroup.search(new_name))
Exemplo n.º 31
0
    def test_positive_create_with_name(self):
        """Create new hostgroup

        :id: 8bcf45e5-9e7f-4050-9de6-a90350b70006

        :expectedresults: Hostgroup is created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 32
0
    def test_positive_create_with_name(self):
        """Create new hostgroup

        :id: 8bcf45e5-9e7f-4050-9de6-a90350b70006

        :expectedresults: Hostgroup is created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 33
0
    def test_positive_delete(self):
        """Delete a hostgroup

        :id: f118532b-ca9b-4bf4-b53b-9573abcb347a

        :expectedresults: Hostgroup is deleted

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in generate_strings_list(length=4):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.hostgroup.delete(name, dropdown_present=True)
Exemplo n.º 34
0
    def test_negative_create_with_same_name(self):
        """Create new hostgroup with same name

        @Feature: Hostgroup - Negative Create

        @Assert: Hostgroup is not created
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(
                self.hostgroup.wait_until_element(
                    common_locators['name_haserror']))
Exemplo n.º 35
0
    def test_negative_create_with_same_name(self):
        """Create new hostgroup with same name

        @id: 237b684d-3b55-444a-be00-a9825952bb53

        @Assert: Hostgroup is not created
        """
        name = gen_string('utf8')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(
                self.hostgroup.wait_until_element(
                    common_locators['name_haserror']))
Exemplo n.º 36
0
    def test_positive_update(self):
        """Update hostgroup with a new name

        @id: 7c8de1b8-aced-44f0-88a0-dc9e6b83bf7f

        @Assert: Hostgroup is updated
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            for new_name in generate_strings_list(length=4):
                with self.subTest(new_name):
                    self.hostgroup.update(name, new_name=new_name)
                    self.assertIsNotNone(self.hostgroup.search(new_name))
                    name = new_name  # for next iteration
Exemplo n.º 37
0
    def test_positive_update(self):
        """Update hostgroup with a new name

        @Feature: Hostgroup - Positive Update

        @Assert: Hostgroup is updated
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            for new_name in generate_strings_list(length=4):
                with self.subTest(new_name):
                    self.hostgroup.update(name, new_name=new_name)
                    self.assertIsNotNone(self.hostgroup.search(new_name))
                    name = new_name  # for next iteration
Exemplo n.º 38
0
    def test_positive_update(self):
        """Update hostgroup with a new name

        @Feature: Hostgroup - Positive Update

        @Assert: Hostgroup is updated
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            for new_name in generate_strings_list(length=4):
                with self.subTest(new_name):
                    self.hostgroup.update(name, new_name=new_name)
                    self.assertIsNotNone(self.hostgroup.search(new_name))
                    name = new_name  # for next iteration
Exemplo n.º 39
0
    def test_negative_create_with_invalid_name(self):
        """Create new hostgroup with invalid names

        :id: a0232740-ae9f-44ce-9f3d-bafc8f1b05cb

        :expectedresults: Hostgroup is not created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(
                        self.hostgroup.wait_until_element(
                            common_locators['name_haserror']))
Exemplo n.º 40
0
    def test_positive_update(self):
        """Update hostgroup with a new name

        @id: 7c8de1b8-aced-44f0-88a0-dc9e6b83bf7f

        @Assert: Hostgroup is updated
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            for new_name in generate_strings_list(length=4):
                with self.subTest(new_name):
                    self.hostgroup.update(name, new_name=new_name)
                    self.assertIsNotNone(self.hostgroup.search(new_name))
                    name = new_name  # for next iteration
Exemplo n.º 41
0
    def test_negative_create_with_same_name(self):
        """Create new hostgroup with same name

        :id: 237b684d-3b55-444a-be00-a9825952bb53

        :expectedresults: Hostgroup is not created

        :CaseImportance: Critical
        """
        name = gen_string('utf8')
        with Session(self) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(
                self.hostgroup.wait_until_element(
                    common_locators['name_haserror']))
Exemplo n.º 42
0
    def test_negative_create_with_invalid_name(self):
        """Create new hostgroup with invalid names

        :id: a0232740-ae9f-44ce-9f3d-bafc8f1b05cb

        :expectedresults: Hostgroup is not created

        :CaseImportance: Critical
        """
        with Session(self) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_hostgroup(session, name=name)
                    self.assertIsNotNone(
                        self.hostgroup.wait_until_element(
                            common_locators['name_haserror'])
                    )
Exemplo n.º 43
0
    def test_positive_create_with_activation_keys(self):
        """Create new hostgroup with activation keys

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

        @Assert: Hostgroup is created with activation keys
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(
                session,
                name=name,
                environment=self.env.name,
                content_view=self.cv.name,
                activation_key=self.ak.name,
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 44
0
    def test_negative_create_with_same_name(self):
        """Create new hostgroup with same name

        :id: 237b684d-3b55-444a-be00-a9825952bb53

        :expectedresults: Hostgroup is not created

        :CaseImportance: Critical
        """
        name = gen_string('utf8')
        with Session(self) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            make_hostgroup(session, name=name)
            self.assertIsNotNone(
                self.hostgroup.wait_until_element(
                    common_locators['name_haserror'])
            )
Exemplo n.º 45
0
    def test_positive_create_with_oscap_capsule(self):
        """Create new hostgroup with oscap capsule

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

        @Assert: Hostgroup is created with oscap capsule
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_hostgroup(
                    session,
                    content_source=self.sat6_hostname,
                    name=name,
                    puppet_ca=self.sat6_hostname,
                    puppet_master=self.sat6_hostname,
                    oscap_capsule=self.sat6_hostname,
                )
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 46
0
    def test_positive_update(self):
        """Update hostgroup with a new name

        :id: 7c8de1b8-aced-44f0-88a0-dc9e6b83bf7f

        :expectedresults: Hostgroup is updated

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            for new_name in generate_strings_list(length=4):
                with self.subTest(new_name):
                    self.hostgroup.update(name, new_name=new_name)
                    self.assertIsNotNone(self.hostgroup.search(new_name))
                    name = new_name  # for next iteration
Exemplo n.º 47
0
    def test_positive_update(self):
        """Update hostgroup with a new name

        :id: 7c8de1b8-aced-44f0-88a0-dc9e6b83bf7f

        :expectedresults: Hostgroup is updated

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_hostgroup(session, name=name)
            self.assertIsNotNone(self.hostgroup.search(name))
            for new_name in generate_strings_list(length=4):
                with self.subTest(new_name):
                    self.hostgroup.update(name, new_name=new_name)
                    self.assertIsNotNone(self.hostgroup.search(new_name))
                    name = new_name  # for next iteration
Exemplo n.º 48
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.browser) as session:
            make_hostgroup(
                session,
                name=name,
                environment=self.env.name,
                content_view=self.cv.name,
                activation_key=self.ak.name,
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 49
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.browser) as session:
            make_hostgroup(
                session,
                content_source=self.sat6_hostname,
                name=name,
                puppet_ca=self.sat6_hostname,
                puppet_master=self.sat6_hostname,
                oscap_capsule=self.sat6_hostname,
            )
            self.assertIsNotNone(self.hostgroup.search(name))
Exemplo n.º 50
0
 def test_add_hostgroup_1(self, host_grp):
     """
     @test: Add a hostgroup by using the organization
     name and hostgroup name.
     @feature: Organizations associate host-group.
     @assert: hostgroup is added to organization
     """
     strategy, value = common_locators["entity_deselect"]
     org_name = generate_string("alpha", 8)
     with Session(self.browser) as session:
         make_org(session, org_name=org_name)
         self.assertIsNotNone(self.org.search(org_name))
         make_hostgroup(session, name=host_grp)
         self.assertIsNotNone(self.hostgroup.search(host_grp))
         self.org.update(org_name, new_hostgroups=[host_grp])
         self.org.search(org_name).click()
         session.nav.wait_until_element(
             tab_locators["context.tab_hostgrps"]).click()
         element = session.nav.wait_until_element((strategy,
                                                   value % host_grp))
         self.assertIsNotNone(element)
Exemplo n.º 51
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))
Exemplo n.º 52
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))
Exemplo n.º 53
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))
Exemplo n.º 54
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))
Exemplo n.º 55
0
    def test_positive_smoke(self):
        """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')
        password = gen_string('alpha')
        org_name = gen_string('alpha')
        env_1_name = gen_string('alpha')
        env_2_name = gen_string('alpha')
        product_name = gen_string('alpha')
        yum_repository_name = gen_string('alpha')
        puppet_repository_name = gen_string('alpha')
        cv_name = gen_string('alpha')
        compute_resource_name = gen_string('alpha')
        subnet_name = gen_string('alpha')
        domain_name = gen_string('alpha')
        domain = DOMAIN % domain_name
        hostgroup_name = gen_string('alpha')

        # 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))
            self.assertTrue(self.user.user_admin_role_toggle(user_name))

        # 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)
            self.assertIsNotNone(self.lifecycleenvironment.search(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.lifecycleenvironment.search(env_2_name))

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

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

            # Create a puppet Repository
            self.products.search(product_name).click()
            make_repository(
                session,
                name=puppet_repository_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()
            self.assertIsNotNone(self.sync.sync_custom_repos(
                product_name,
                [yum_repository_name, puppet_repository_name]
            ))

            # 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
            if not bz_bug_is_open(1297308):
                self.content_views.add_puppet_module(
                    cv_name, 'httpd', filter_term='Latest'
                )

            # 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
            url = (
                LIBVIRT_RESOURCE_URL % settings.server.hostname
            )
            make_resource(
                session,
                org=org_name,
                name=compute_resource_name,
                provider_type=FOREMAN_PROVIDERS['libvirt'],
                parameter_list=[['URL', url, 'field']],
            )
            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_name))

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

            # Create a HostGroup
            make_hostgroup(session, name=hostgroup_name)
            self.assertIsNotNone(self.hostgroup.search(hostgroup_name))
    def test_positive_apply_vmware_with_custom_profile_to_host(self):
        """Associate custom default (3-Large) compute profile with hostgroup
        and then inherit it to the host

        :id: c16c6d42-3950-46a7-bfe6-5e19bcfa29d0

        :customerscenario: true

        :setup: vmware hostname and credentials.

        :steps:

            1. Create a compute resource of type vmware.
            2. Provide valid hostname, username and password.
            3. Select the created vmware CR.
            4. Click Compute Profile tab.
            5. Edit (3-Large) with valid configurations and submit.
            6. Create new host group with custom profile
            7. Open new host page and put host group name into corresponding
               field
            8. Check that compute profile is inherited and then switch to
               Virtual Machine tab

        :expectedresults: All fields values for Virtual Machine tab are
            inherited from custom profile and have non default values

        :Caseautomation: Automated

        :BZ: 1249744

        :CaseLevel: Integration
        """
        org = entities.Organization().create()
        parameter_list = [
            ['VCenter/Server', self.vmware_url, 'field'],
            ['Username', self.vmware_username, 'field'],
            ['Password', self.vmware_password, 'field'],
            ['Datacenter', self.vmware_datacenter, 'special select'],
        ]
        name = gen_string('alpha')
        hg_name = gen_string('alpha')
        with Session(self) as session:
            make_resource(session,
                          name=name,
                          provider_type=FOREMAN_PROVIDERS['vmware'],
                          orgs=[org.name],
                          org_select=True,
                          parameter_list=parameter_list)
            self.compute_resource.set_profile_values(
                name,
                COMPUTE_PROFILE_LARGE,
                cpus=3,
                corespersocket=4,
                memory=2048,
                cluster=VMWARE_CONSTANTS.get('cluster'),
                folder=VMWARE_CONSTANTS.get('folder'),
            )
            self.assertIsNotNone(self.compute_resource.search(name))
            make_hostgroup(
                session,
                name=hg_name,
                organizations=[org.name],
                parameters_list=[
                    ['Host Group', 'Compute Profile', COMPUTE_PROFILE_LARGE],
                ],
            )
            self.hosts.navigate_to_entity()
            self.hosts.click(locators['host.new'])
            self.hosts.assign_value(locators['host.organization'], org.name)
            # Selecting host group and then compute resource. It is not
            # possible to do it in opposite order as mentioned in initial BZ,
            # because selecting host group will always reset most fields values
            self.hosts.assign_value(locators['host.host_group'], hg_name)
            self.hosts.click(locators['host.deploy_on'])
            self.hosts.assign_value(common_locators['select_list_search_box'],
                                    name)
            self.hosts.click(common_locators['entity_select_list'] %
                             '{} (VMware)'.format(name))
            # Check that compute profile is inherited automatically from host
            # group
            self.assertEqual(
                self.hosts.get_element_value(
                    locators['host.fetch_compute_profile']),
                COMPUTE_PROFILE_LARGE)
            # Open Virtual Machine tab
            self.hosts.click(tab_locators['host.tab_virtual_machine'])
            # Check that all values are inherited from custom profile
            for locator, value in [
                ['host.cpus', '3'],
                ['host.cores', '4'],
                ['host.memory', '2048'],
                ['host.fetch_cluster',
                 VMWARE_CONSTANTS.get('cluster')],
                ['host.fetch_folder',
                 VMWARE_CONSTANTS.get('folder')],
            ]:
                self.assertEqual(
                    self.hosts.get_element_value(locators[locator]), value)
Exemplo n.º 57
0
    def test_positive_end_to_end(self):
        """Perform end to end smoke tests using RH and custom repos.

        1. Create a new user with admin permissions
        2. Using the new user from above
            1. Create a new organization
            2. Clone and upload manifest
            3. Create a new lifecycle environment
            4. Create a custom product
            5. Create a custom YUM repository
            6. Create a custom PUPPET repository
            7. Enable a Red Hat repository
            8. Synchronize the three repositories
            9. Create a new content view
            10. Associate the YUM and Red Hat repositories to new content view
            11. Add a PUPPET module to new content view
            12. Publish content view
            13. Promote content view to the lifecycle environment
            14. Create a new activation key
            15. Add the products to the activation key
            16. Create a new libvirt compute resource
            17. Create a new subnet
            18. Create a new domain
            19. Create a new hostgroup and associate previous entities to it
            20. Provision a client

        @id: 6b7c6187-3cc2-4bd3-89f2-fa7a5f570986

        @Assert: All tests should succeed and Content should be successfully
        fetched by client.
        """
        activation_key_name = gen_string('alpha')
        compute_resource_name = gen_string('alpha')
        cv_name = gen_string('alpha')
        domain_name = DOMAIN % gen_string('alpha')
        hostgroup_name = gen_string('alpha')
        lce_name = gen_string('alpha')
        org_name = gen_string('alpha')
        password = gen_string('alpha')
        product_name = gen_string('alpha')
        puppet_repository_name = gen_string('alpha')
        if self.fake_manifest_is_set:
            repos = self.sync.create_repos_tree(RHVA_REPO_TREE)
        subnet_name = gen_string('alpha')
        username = gen_string('alpha')
        yum_repository_name = gen_string('alpha')

        # step 1: Create a new user with admin permissions
        with Session(self.browser) as session:
            make_user(
                session,
                admin=True,
                password1=password,
                password2=password,
                username=username,
            )
            self.assertIsNotNone(self.user.search(username))
            self.assertTrue(self.user.user_admin_role_toggle(username))

        with Session(self.browser, username, password) as session:
            # step 2.1: Create a new organization
            make_org(session, org_name=org_name)
            self.assertIsNotNone(self.org.search(org_name))

            # step 2.2: Clone and upload manifest
            if self.fake_manifest_is_set:
                session.nav.go_to_select_org(org_name)
                session.nav.go_to_red_hat_subscriptions()
                with manifests.clone() as manifest:
                    self.subscriptions.upload(manifest)
                self.assertTrue(
                    session.nav.wait_until_element(
                        common_locators['alert.success']))

            # step 2.3: Create a new lifecycle environment
            make_lifecycle_environment(session, org=org_name, name=lce_name)
            self.assertIsNotNone(self.lifecycleenvironment.search(lce_name))

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

            # step 2.5: Create custom YUM repository
            self.products.search(product_name).click()
            make_repository(session,
                            name=yum_repository_name,
                            url=CUSTOM_RPM_REPO)
            self.assertIsNotNone(self.repository.search(yum_repository_name))

            # step 2.6: Create custom PUPPET repository
            self.products.search(product_name).click()
            make_repository(session,
                            name=puppet_repository_name,
                            url=FAKE_0_PUPPET_REPO,
                            repo_type=REPO_TYPE['puppet'])
            self.assertIsNotNone(
                self.repository.search(puppet_repository_name))

            # step 2.7: Enable a Red Hat repository
            if self.fake_manifest_is_set:
                session.nav.go_to_red_hat_repositories()
                self.sync.enable_rh_repos(repos, REPO_TAB['rpms'])

            # step 2.8: Synchronize the three repositories
            self.navigator.go_to_sync_status()
            self.assertIsNotNone(
                self.sync.sync_custom_repos(
                    product_name,
                    [yum_repository_name, puppet_repository_name]))
            if self.fake_manifest_is_set:
                self.assertTrue(self.sync.sync_rh_repos(repos))

            # step 2.9: 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, [yum_repository_name])
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success']))

            # step 2.10: Associate the YUM and Red Hat repositories to new
            # content view
            repositories = [yum_repository_name]
            if self.fake_manifest_is_set:
                repositories.append(REPOS['rhva65']['name'])
                repositories.append(REPOS['rhva6']['name'])
            self.content_views.add_remove_repos(cv_name, repositories)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success']))

            # step 2.11: Add a PUPPET module to new content view
            self.content_views.add_puppet_module(cv_name,
                                                 'httpd',
                                                 filter_term='Latest')

            # step 2.12: Publish content view
            self.content_views.publish(cv_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))

            # step 2.13: Promote content view to the lifecycle environment
            self.content_views.promote(cv_name,
                                       version='Version 1',
                                       env=lce_name)
            self.assertIsNotNone(
                self.content_views.wait_until_element(
                    common_locators['alert.success_sub_form']))

            # step 2.14: Create a new activation key
            make_activationkey(session,
                               org=org_name,
                               name=activation_key_name,
                               env=lce_name,
                               content_view=cv_name)
            self.assertIsNotNone(
                self.activationkey.wait_until_element(
                    common_locators['alert.success']))

            # step 2.15: Add the products to the activation key
            self.activationkey.associate_product(activation_key_name,
                                                 [DEFAULT_SUBSCRIPTION_NAME])

            # step 2.15.1: Enable product content
            if self.fake_manifest_is_set:
                self.activationkey.enable_repos(activation_key_name,
                                                [REPOSET['rhva6']])

            # step 2.16: Create a new libvirt compute resource
            make_resource(
                session,
                org=org_name,
                name=compute_resource_name,
                provider_type=FOREMAN_PROVIDERS['libvirt'],
                parameter_list=[[
                    'URL',
                    (LIBVIRT_RESOURCE_URL %
                     settings.compute_resources.libvirt_hostname), 'field'
                ]],
            )
            self.assertIsNotNone(
                self.compute_resource.search(compute_resource_name))

            # step 2.17: Create a new 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_name))

            # step 2.18: Create a new domain
            make_domain(session,
                        org=org_name,
                        name=domain_name,
                        description=domain_name)
            self.assertIsNotNone(self.domain.search(domain_name))

            # step 2.19: Create a new hostgroup and associate previous entities
            # to it
            make_hostgroup(session, name=hostgroup_name)
            self.assertIsNotNone(self.hostgroup.search(hostgroup_name))

        # step 2.20: Provision a client
        self.client_provisioning(activation_key_name, org_name)
Exemplo n.º 58
0
    def test_positive_push_updated_content(self):
        """Perform end to end oscap test, and push the updated scap content
         after first run.

        :id: 7eb75ca5-2ea1-434e-bb43-1223fa4d8e9f

        :expectedresults: Satellite should push updated content to Clients and
            satellite should get updated reports

        :CaseLevel: System
        """
        if settings.rhel7_repo is None:
            self.skipTest('Missing configuration for rhel7_repo')
        rhel7_repo = settings.rhel7_repo
        rhel7_content = OSCAP_DEFAULT_CONTENT['rhel7_content']
        content_update = OSCAP_DEFAULT_CONTENT['rhel_firefox']
        hgrp7_name = gen_string('alpha')
        policy_values = {
            'content': rhel7_content,
            'hgrp': hgrp7_name,
            'policy': gen_string('alpha'),
        }
        vm_values = {
            'distro': DISTRO_RHEL7,
            'hgrp': hgrp7_name,
            'rhel_repo': rhel7_repo,
        }
        with Session(self) as session:
            set_context(session, org=ANY_CONTEXT['org'])
            # Creates oscap content for rhel7
            session.nav.go_to_oscap_content()
            self.oscapcontent.update(rhel7_content,
                                     content_org=self.config_env['org_name'])
            self.oscapcontent.update(content_update,
                                     content_org=self.config_env['org_name'])
            set_context(session, org=self.config_env['org_name'])
            # Creates host_group for rhel7
            make_hostgroup(
                session,
                content_source=self.config_env['sat6_hostname'],
                name=hgrp7_name,
                puppet_ca=self.config_env['sat6_hostname'],
                puppet_master=self.config_env['sat6_hostname'],
            )
            # Creates oscap_policy for both rhel6 and rhel7.
            make_oscappolicy(
                session,
                content=policy_values.get('content'),
                host_group=policy_values.get('hgrp'),
                name=policy_values.get('policy'),
                period=OSCAP_PERIOD['weekly'],
                profile=OSCAP_PROFILE['common'],
                period_value=OSCAP_WEEKDAY['friday'],
            )
            # Creates two vm's each for rhel6 and rhel7, runs
            # openscap scan and uploads report to satellite6.
            with VirtualMachine(distro=vm_values.get('distro')) as vm:
                host = vm.hostname
                vm.install_katello_ca()
                vm.register_contenthost(self.config_env['org_name'],
                                        self.config_env['ak_name'])
                self.assertTrue(vm.subscribed)
                vm.configure_puppet(vm_values.get('rhel_repo'))
                self.hosts.update(
                    name=vm._target_image,
                    domain_name=vm._domain,
                    parameters_list=[
                        [
                            'Host', 'Lifecycle Environment',
                            self.config_env['env_name']
                        ],
                        ['Host', 'Content View', self.config_env['cv_name']],
                        ['Host', 'Host Group',
                         vm_values.get('hgrp')],
                        ['Host', 'Reset Puppet Environment', True],
                    ],
                )
                # Run "puppet agent -t" twice so that it detects it's,
                # satellite6 and fetch katello SSL certs.
                for _ in range(2):
                    vm.run(u'puppet agent -t 2> /dev/null')
                result = vm.run(u'cat /etc/foreman_scap_client/config.yaml'
                                '| grep content_path')
                self.assertEqual(result.return_code, 0)
                # Runs the actual oscap scan on the vm/clients and
                # uploads report to Internal Capsule.
                vm.execute_foreman_scap_client()
                # Assert whether oscap reports are uploaded to
                # Satellite6.
                self.assertTrue(self.oscapreports.search(host))
                self.oscappolicy.update(
                    name=policy_values.get('policy'),
                    new_name=gen_string('alpha'),
                    content=OSCAP_DEFAULT_CONTENT['rhel_firefox'],
                    profile=OSCAP_PROFILE['firefox'],
                    period=OSCAP_PERIOD['weekly'],
                    period_value=OSCAP_WEEKDAY['friday'],
                )
                self.oscapreports.delete(host, really=True)
                for _ in range(2):
                    vm.run(u'puppet agent -t 2> /dev/null')
                updated_result = vm.run(
                    u'cat /etc/foreman_scap_client/config.yaml'
                    '| grep content_path')
                self.assertIsNot(result, updated_result)
                self.assertEqual(updated_result.return_code, 0)
                # Runs the actual oscap scan on the vm/clients and
                # uploads report to Internal Capsule.
                vm.execute_foreman_scap_client()
                self.assertTrue(self.oscapreports.search(host))
Exemplo n.º 59
0
    def test_positive_upload_to_satellite(self):
        """Perform end to end oscap test and upload reports.

        :id: 17a0978d-64f9-44ad-8303-1f54ada08602

        :expectedresults: Oscap reports from rhel6 and rhel7 clients should be
            uploaded to satellite6 and be searchable.

        :CaseLevel: System
        """
        if settings.rhel6_repo is None:
            self.skipTest('Missing configuration for rhel6_repo')
        rhel6_repo = settings.rhel6_repo
        if settings.rhel7_repo is None:
            self.skipTest('Missing configuration for rhel7_repo')
        rhel7_repo = settings.rhel7_repo
        rhel6_content = OSCAP_DEFAULT_CONTENT['rhel6_content']
        rhel7_content = OSCAP_DEFAULT_CONTENT['rhel7_content']
        hgrp6_name = gen_string('alpha')
        hgrp7_name = gen_string('alpha')
        policy_values = [
            {
                'content': rhel6_content,
                'hgrp': hgrp6_name,
                'policy': gen_string('alpha'),
            },
            {
                'content': rhel7_content,
                'hgrp': hgrp7_name,
                'policy': gen_string('alpha'),
            },
        ]
        vm_values = [
            {
                'distro': DISTRO_RHEL6,
                'hgrp': hgrp6_name,
                'rhel_repo': rhel6_repo,
            },
            {
                'distro': DISTRO_RHEL7,
                'hgrp': hgrp7_name,
                'rhel_repo': rhel7_repo,
            },
        ]
        with Session(self) as session:
            set_context(session, org=ANY_CONTEXT['org'])
            # Creates oscap content for both rhel6 and rhel7
            for content in [rhel6_content, rhel7_content]:
                session.nav.go_to_oscap_content()
                self.oscapcontent.update(
                    content, content_org=self.config_env['org_name'])
            set_context(session, org=self.config_env['org_name'])
            # Creates host_group for both rhel6 and rhel7
            for host_group in [hgrp6_name, hgrp7_name]:
                make_hostgroup(
                    session,
                    content_source=self.config_env['sat6_hostname'],
                    name=host_group,
                    puppet_ca=self.config_env['sat6_hostname'],
                    puppet_master=self.config_env['sat6_hostname'],
                )
            # Creates oscap_policy for both rhel6 and rhel7.
            for value in policy_values:
                make_oscappolicy(
                    session,
                    content=value['content'],
                    host_group=value['hgrp'],
                    name=value['policy'],
                    period=OSCAP_PERIOD['weekly'],
                    profile=OSCAP_PROFILE['common'],
                    period_value=OSCAP_WEEKDAY['friday'],
                )
            # Creates two vm's each for rhel6 and rhel7, runs
            # openscap scan and uploads report to satellite6.
            for value in vm_values:
                with VirtualMachine(distro=value['distro']) as vm:
                    host = vm.hostname
                    vm.install_katello_ca()
                    vm.register_contenthost(self.config_env['org_name'],
                                            self.config_env['ak_name'])
                    self.assertTrue(vm.subscribed)
                    vm.configure_puppet(value['rhel_repo'])
                    self.hosts.update(
                        name=vm._target_image,
                        domain_name=vm._domain,
                        parameters_list=[
                            [
                                'Host', 'Lifecycle Environment',
                                self.config_env['env_name']
                            ],
                            [
                                'Host', 'Content View',
                                self.config_env['cv_name']
                            ],
                            ['Host', 'Host Group', value['hgrp']],
                            ['Host', 'Reset Puppet Environment', True],
                        ],
                    )
                    session.nav.go_to_hosts()
                    # Run "puppet agent -t" twice so that it detects it's,
                    # satellite6 and fetch katello SSL certs.
                    for _ in range(2):
                        vm.run(u'puppet agent -t 2> /dev/null')
                    result = vm.run(u'cat /etc/foreman_scap_client/config.yaml'
                                    '| grep profile')
                    self.assertEqual(result.return_code, 0)
                    # Runs the actual oscap scan on the vm/clients and
                    # uploads report to Internal Capsule.
                    vm.execute_foreman_scap_client()
                    # Assert whether oscap reports are uploaded to
                    # Satellite6.
                    self.assertTrue(self.oscapreports.search(host))
Exemplo n.º 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))