def test_clone_template(self):
        """@Test: Assure ability to clone a provisioning template

        @Feature: Template - Clone

        @Steps:
         1.  Go to Provisioning template UI
         2.  Choose a template and attempt to clone it

        @Assert: template is cloned

        """
        name = gen_string("alpha", 6)
        clone_name = gen_string("alpha", 6)
        temp_type = 'provision'
        os_list = [
            entities.OperatingSystem().create()['name'] for _ in range(2)
        ]
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path,
                           custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.clone(name, custom_really=False,
                                clone_name=clone_name, os_list=os_list)
            self.assertIsNotNone(self.template.search(clone_name))
Example #2
0
    def test_update_template_os(self):
        """@Test: Creates new template, along with two OS's
        and associate list of OS's with created template

        @Feature: Template - Positive Update

        @Assert: The template should be updated with newly created OS's
        successfully

        """
        name = gen_string('alpha')
        new_name = gen_string('alpha')
        os_list = [
            entities.OperatingSystem().create().name for _ in range(2)
        ]
        with Session(self.browser) as session:
            make_templates(
                session,
                name=name,
                template_path=get_data_file(OS_TEMPLATE_DATA_FILE),
                custom_really=True,
                template_type='provision',
            )
            self.assertIsNotNone(self.template.search(name))
            self.template.update(name, False, new_name, new_os_list=os_list)
            self.assertIsNotNone(self.template.search(new_name))
Example #3
0
    def test_add_configtemplate_1(self, template):
        """
        @feature: Organizations
        @test: Add config template by using organization name and
        configtemplate name
        @assert: configtemplate is added
        @BZ: 1076562
        """

        strategy = common_locators["entity_deselect"][0]
        value = common_locators["entity_deselect"][1]
        org_name = generate_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.navigator.go_to_org()
        self.org.create(org_name)
        self.navigator.go_to_org()
        self.assertIsNotNone(self.org.search(org_name))
        self.navigator.go_to_provisioning_templates()
        self.template.create(template, template_path, True,
                             temp_type, None)
        self.assertIsNotNone(self.template.search(template))
        self.navigator.go_to_org()
        self.org.update(org_name, new_templates=[template])
        self.org.search(org_name).click()
        self.org.wait_until_element(tab_locators["orgs.tab_media"]).click()
        element = self.org.wait_until_element((strategy,
                                               value % template))
        self.assertTrue(element)
Example #4
0
    def test_negative_create_template_4(self):
        """@Test: Template - Create a new template with same name

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        name = gen_string("alpha", 16)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(
                self.template.wait_until_element(
                    common_locators["name_haserror"]))
Example #5
0
    def test_add_configtemplate_1(self, template):
        """@test: Add config template by using organization name and
        configtemplate name.

        @feature: Organizations associate config template.

        @assert: configtemplate is added

        @BZ: 1129612

        """
        strategy, value = common_locators["entity_deselect"]
        org_name = generate_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_org(session, org_name=org_name)
            self.assertIsNotNone(self.org.search(org_name))
            session.nav.go_to_provisioning_templates()
            make_templates(session, name=template, template_path=template_path,
                           custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(template))
            self.org.update(org_name, new_templates=[template])
            self.org.search(org_name).click()
            self.org.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % template))
            self.assertIsNotNone(element)
Example #6
0
    def test_add_configtemplate_1(self, template):
        """
        @feature: Organizations
        @test: Add config template by using organization name and
        configtemplate name
        @assert: configtemplate is added
        @BZ: 1076562
        """

        strategy = common_locators["entity_deselect"][0]
        value = common_locators["entity_deselect"][1]
        org_name = generate_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.navigator.go_to_org()
        self.org.create(org_name)
        self.navigator.go_to_org()
        self.assertIsNotNone(self.org.search(org_name))
        self.navigator.go_to_provisioning_templates()
        self.template.create(template, template_path, True, temp_type, None)
        self.assertIsNotNone(self.template.search(template))
        self.navigator.go_to_org()
        self.org.update(org_name, new_templates=[template])
        self.org.search(org_name).click()
        self.org.wait_until_element(tab_locators["orgs.tab_media"]).click()
        element = self.org.wait_until_element((strategy, value % template))
        self.assertTrue(element)
Example #7
0
    def test_add_configtemplate_1(self, template):
        """@test: Add config template by using location name and
        configtemplate name.

        @feature: Locations

        @assert: configtemplate is added.

        """
        strategy, value = common_locators["all_values_selection"]
        loc_name = gen_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_loc(session, name=loc_name)
            self.assertIsNotNone(self.location.search(loc_name))
            make_templates(session, name=template, template_path=template_path,
                           custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(template))
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % template))
            self.assertIsNotNone(element)
Example #8
0
    def test_add_configtemplate_1(self, template):
        """@test: Add config template by using location name and
        configtemplate name.

        @feature: Locations

        @assert: configtemplate is added.

        """
        strategy, value = common_locators["all_values_selection"]
        loc_name = gen_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_loc(session, name=loc_name)
            self.assertIsNotNone(self.location.search(loc_name))
            make_templates(session,
                           name=template,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(self.template.search(template))
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element(
                (strategy, value % template))
            self.assertIsNotNone(element)
    def test_update_template_os(self):
        """@Test: Creates new template, along with two OS's
        and associate list of OS's with created template

        @Feature: Template - Positive Update

        @Assert: The template should be updated with newly created OS's
        successfully

        @BZ: 1129612

        """
        name = gen_string("alpha", 6)
        new_name = gen_string("alpha", 6)
        temp_type = 'provision'
        os_1_name = entities.OperatingSystem().create()['name']
        os_2_name = entities.OperatingSystem().create()['name']
        os_list = [os_1_name, os_2_name]
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path,
                           custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.update(name, False, new_name, new_os_list=os_list)
            self.assertIsNotNone(self.template.search(new_name))
Example #10
0
    def test_upload_content(self):
        """@Test: Create repository and upload content

        @Feature: Repository

        @Assert: upload content is successful

        """
        name = gen_string('alpha', 15)
        try:
            new_repo = self._make_repository({'name': name})
        except CLIFactoryError as err:
            self.fail(err)

        ssh.upload_file(local_file=get_data_file(RPM_TO_UPLOAD),
                        remote_file="/tmp/{0}".format(RPM_TO_UPLOAD))
        result = Repository.upload_content({
            'name':
            new_repo['name'],
            'path':
            "/tmp/{0}".format(RPM_TO_UPLOAD),
            'product-id':
            new_repo['product']['id'],
            'organization':
            new_repo['organization'],
        })
        self.assertEqual(
            result.return_code, 0, "return code must be 0, instead got {0}"
            ''.format(result.return_code))
        self.assertEqual(len(result.stderr), 0, "No error was expected")
        self.assertIn(
            "Successfully uploaded file '{0}'"
            ''.format(RPM_TO_UPLOAD), result.stdout[0]['message'])
Example #11
0
    def test_remove_configtemplate_1(self, template):
        """
        @feature: Organizations
        @test: Remove config template
        @assert: configtemplate is added then removed
        @BZ: 1076562
        """

        strategy = common_locators["entity_select"][0]
        value = common_locators["entity_select"][1]
        strategy1 = common_locators["entity_deselect"][0]
        value1 = common_locators["entity_deselect"][1]
        org_name = generate_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.navigator.go_to_provisioning_templates()
        self.template.create(template, template_path, True, temp_type, None)
        self.assertIsNotNone(self.template.search(template))
        self.navigator.go_to_org()
        self.org.create(org_name, templates=[template], edit=True)
        self.org.search(org_name).click()
        self.org.wait_until_element(tab_locators["orgs.tab_template"]).click()
        element = self.org.wait_until_element((strategy1, value1 % template))
        # Item is listed in 'Selected Items' list and not 'All Items' list.
        self.assertTrue(element)
        self.org.update(org_name, templates=[template])
        self.org.search(org_name).click()
        self.org.wait_until_element(tab_locators["orgs.tab_template"]).click()
        element = self.org.wait_until_element((strategy, value % template))
        # Item is listed in 'All Items' list and not 'Selected Items' list.
        self.assertTrue(element)
Example #12
0
 def test_remove_configtemplate_1(self, template):
     """
     @test: Remove config template.
     @feature: Organizations dissociate config templates.
     @assert: configtemplate is added then removed.
     @BZ: 1129612
     """
     strategy, value = common_locators["entity_select"]
     strategy1, value1 = common_locators["entity_deselect"]
     org_name = generate_string("alpha", 8)
     temp_type = 'provision'
     template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
     with Session(self.browser) as session:
         make_templates(session, name=template, template_path=template_path,
                        custom_really=True, template_type=temp_type)
         self.assertIsNotNone(self.template.search(template))
         make_org(session, org_name=org_name, templates=[template],
                  edit=True)
         self.org.search(org_name).click()
         session.nav.wait_until_element(
             tab_locators["context.tab_template"]).click()
         element = session.nav.wait_until_element((strategy1,
                                                   value1 % template))
         # Item is listed in 'Selected Items' list and not 'All Items' list.
         self.assertIsNotNone(element)
         self.org.update(org_name, templates=[template])
         self.org.search(org_name).click()
         session.nav.wait_until_element(
             tab_locators["context.tab_template"]).click()
         element = self.org.wait_until_element((strategy,
                                                value % template))
         # Item is listed in 'All Items' list and not 'Selected Items' list.
         self.assertIsNotNone(element)
Example #13
0
    def test_update_template_os(self):
        """@Test: Creates new template, along with two OS's
        and associate list of OS's with created template

        @Feature: Template - Positive Update

        @Assert: The template should be updated with newly created OS's
        successfully

        @BZ: 1129612

        """
        name = generate_string("alpha", 6)
        new_name = generate_string("alpha", 6)
        temp_type = 'provision'
        os_name1 = generate_string("alpha", 6)
        os_name2 = generate_string("alpha", 6)
        os_list = [os_name1, os_name2]
        major_version = generate_string('numeric', 1)
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            for os_name in os_list:
                make_os(session, name=os_name,
                        major_version=major_version)
                self.assertIsNotNone(self.operatingsys.search(os_name))
            make_templates(session, name=name, template_path=template_path,
                           custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.update(name, False, new_name, new_os_list=os_list)
            self.assertIsNotNone(self.template.search(new_name))
Example #14
0
    def test_upload_content(self):
        """@Test: Create repository and upload content

        @Feature: Repository

        @Assert: upload content is successful

        """
        name = gen_string('alpha', 15)
        try:
            new_repo = self._make_repository({'name': name})
        except CLIFactoryError as err:
            self.fail(err)

        ssh.upload_file(local_file=get_data_file(RPM_TO_UPLOAD),
                        remote_file="/tmp/{0}".format(RPM_TO_UPLOAD))
        result = Repository.upload_content({
            'name': new_repo['name'],
            'path': "/tmp/{0}".format(RPM_TO_UPLOAD),
            'product-id': new_repo['product']['id'],
            'organization': new_repo['organization'],
        })
        self.assertEqual(result.return_code, 0,
                         "return code must be 0, instead got {0}"
                         ''.format(result.return_code))
        self.assertEqual(
            len(result.stderr), 0, "No error was expected")
        self.assertIn("Successfully uploaded file '{0}'"
                      ''.format(RPM_TO_UPLOAD),
                      result.stdout[0]['message'])
Example #15
0
    def test_update_template_os(self):
        """@Test: Creates new template, along with two OS's
        and associate list of OS's with created template

        @Feature: Template - Positive Update

        @Assert: The template should be updated with newly created OS's
        successfully

        """
        name = gen_string("alpha", 6)
        new_name = gen_string("alpha", 6)
        temp_type = 'provision'
        os_list = [
            entities.OperatingSystem().create_json()['name'] for _ in range(2)
        ]
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.update(name, False, new_name, new_os_list=os_list)
            self.assertIsNotNone(self.template.search(new_name))
Example #16
0
    def test_clone_template(self):
        """@Test: Assure ability to clone a provisioning template

        @Feature: Template - Clone

        @Steps:
         1.  Go to Provisioning template UI
         2.  Choose a template and attempt to clone it

        @Assert: template is cloned

        """
        name = gen_string("alpha", 6)
        clone_name = gen_string("alpha", 6)
        temp_type = 'provision'
        os_list = [
            entities.OperatingSystem().create_json()['name'] for _ in range(2)
        ]
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.clone(name,
                                custom_really=False,
                                clone_name=clone_name,
                                os_list=os_list)
            self.assertIsNotNone(self.template.search(clone_name))
Example #17
0
    def test_remove_configtemplate_1(self, template):
        """@test: Remove config template

        @feature: Locations

        @assert: configtemplate is added then removed

        @BZ: 1096333

        """
        strategy, value = common_locators["all_values_selection"]
        loc_name = generate_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=template, template_path=template_path,
                           template_type=temp_type, custom_really=True)
            self.assertIsNotNone(self.template.search(template))
            make_loc(session, name=loc_name, edit=True)
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % template))
            # Item is listed in 'Selected Items' list and not 'All Items' list.
            self.assertIsNotNone(element)
            self.template.delete(template, True)
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element((strategy,
                                                      value % template))
            # Item is listed in 'All Items' list and not 'Selected Items' list.
            self.assertIsNone(element)
Example #18
0
    def test_update_template_os(self):
        """
        @Feature: Template - Positive Update
        @Test: Creates new template, along with two OS's
        and associate list of OS's with created template
        @Assert: The template should be updated with newly created OS's
        successfully
        """

        name = generate_name(6)
        new_name = generate_name(6)
        temp_type = 'provision'
        os_name1 = generate_name(6)
        os_name2 = generate_name(6)
        os_list = [os_name1, os_name2]
        major_version = generate_string('numeric', 1)
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        for os_name in os_list:
            self.navigator.go_to_operating_systems()
            self.operatingsys.create(os_name, major_version)
            self.assertIsNotNone(self.operatingsys.search(os_name))
        self.create_template(name, template_path, True,
                             temp_type, None)
        self.template.update(name, False, new_name, new_os_list=os_list)
        self.assertIsNotNone(self.template.search(new_name))
Example #19
0
    def test_update_os_template(self):
        """
        @Test: Update provisioning template
        @Feature: OS - Positive Update
        @Assert: OS is updated
        @BZ: 1129612
        """

        os_name = generate_string("alpha", 6)
        major_version = generate_string('numeric', 1)
        template_name = generate_string("alpha", 4)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        os_list = [os_name]
        with Session(self.browser) as session:
            make_os(session, name=os_name,
                    major_version=major_version)
            self.assertIsNotNone(self.operatingsys.search(os_name))
            make_templates(session, name=template_name,
                           template_path=template_path,
                           custom_really=True, template_type=temp_type,
                           os_list=os_list)
            self.assertIsNotNone(self.template.search(template_name))
            self.navigator.go_to_operating_systems()
            self.operatingsys.update(os_name, template=template_name)
            result_obj = self.operatingsys.get_os_entities(os_name, "template")
            self.assertEqual(template_name, result_obj['template'])
Example #20
0
def _gpgkey_content():
    """Return default content for a GPG key.

    :return: The contents of a GPG key.
    :rtype: str

    """
    with open(get_data_file(VALID_GPG_KEY_FILE)) as handle:
        return handle.read()
Example #21
0
    def test_create_snippet_template(self):
        """
        @Feature: Template - Positive Create
        @Test: Create new template of type snippet
        @Assert: New provisioning template of type 'snippet'
        should be created successfully
        """

        name = generate_string("alpha", 6)
        template_path = get_data_file(SNIPPET_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True, None, True)
Example #22
0
    def test_negative_create_template_2(self, name):
        """@Test: Create a new template with blank and whitespace in name

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        temp_type = "provision"
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.wait_until_element(common_locators["name_haserror"]))
Example #23
0
    def test_positive_create_snippet_template(self, name):
        """@Test: Create new template of type snippet

        @Feature: Template - Positive Create

        @Assert: New provisioning template of type 'snippet'
        should be created successfully

        """
        template_path = get_data_file(SNIPPET_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path, custom_really=True, snippet=True)
            self.assertIsNotNone(self.template.search(name))
Example #24
0
 def setUpClass(cls):  # noqa
     """Set up organization, product and repositories for tests."""
     super(CVPublishPromoteTestCase, cls).setUpClass()
     cls.org = entities.Organization().create()
     cls.product = entities.Product(organization=cls.org).create()
     cls.yum_repo = entities.Repository(product=cls.product).create()
     cls.yum_repo.sync()
     cls.puppet_repo = entities.Repository(
         content_type="puppet", product=cls.product.id, url=FAKE_0_PUPPET_REPO
     ).create()
     cls.puppet_repo.sync()
     with open(get_data_file(PUPPET_MODULE_NTP_PUPPETLABS), "rb") as handle:
         cls.puppet_repo.upload_content(files={"content": handle})
Example #25
0
    def test_create_snippet_template(self):
        """
        @Feature: Template - Positive Create
        @Test: Create new template of type snippet
        @Assert: New provisioning template of type 'snippet'
        should be created successfully
        """

        name = generate_name(6)
        template_path = get_data_file(SNIPPET_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True,
                             None, True)
Example #26
0
    def test_positive_update_2(self, repo_name):
        """
        @Feature: Content Repo - Positive Update
        @Test: Update Content Repo with gpg key
        @Assert: Repo is updated with new gpg key
        """

        key_path1 = get_data_file(VALID_GPG_KEY_FILE)
        key_path2 = get_data_file(VALID_GPG_KEY_BETA_FILE)
        prd_name = generate_string("alpha", 8)
        gpgkey_name1 = generate_string("alpha", 8)
        gpgkey_name2 = generate_string("alpha", 8)
        locator = locators["repo.fetch_gpgkey"]
        repo_url = "http://inecas.fedorapeople.org/fakerepos/zoo3/"
        description = "test 123"
        self.login.login(self.katello_user, self.katello_passwd)
        self.navigator.go_to_select_org(self.org_name)
        self.navigator.go_to_gpg_keys()
        self.gpgkey.create(gpgkey_name1, upload_key=True, key_path=key_path1)
        self.assertIsNotNone(self.gpgkey.search(gpgkey_name1))
        self.gpgkey.create(gpgkey_name2, upload_key=True, key_path=key_path2)
        self.assertIsNotNone(self.gpgkey.search(gpgkey_name2))
        self.navigator.go_to_products()
        self.products.create(prd_name, description)
        self.assertIsNotNone(self.products.search(prd_name))
        self.repository.create(repo_name,
                               product=prd_name,
                               url=repo_url,
                               gpg_key=gpgkey_name1)
        self.assertIsNotNone(self.repository.search(repo_name))
        self.repository.search(repo_name).click()
        gpgkey_text1 = self.repository.wait_until_element(locator).text
        self.assertEqual(gpgkey_text1, gpgkey_name1)
        self.navigator.go_to_products()
        self.products.search(prd_name).click()
        self.repository.update(repo_name, new_gpg_key=gpgkey_name2)
        gpgkey_text2 = self.repository.wait_until_element(locator).text
        self.assertEqual(gpgkey_text2, gpgkey_name2)
Example #27
0
    def test_negative_create_template_1(self):
        """@Test: Template - Create a new template with 256 characters in name

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        name = gen_string("alpha", 256)
        temp_type = "provision"
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.wait_until_element(common_locators["name_haserror"]))
Example #28
0
    def test_create_template(self):
        """
        @Feature: Template - Positive Create
        @Test: Create new template
        @Assert: New provisioning template of type 'provision'
        should be created successfully
        """

        name = generate_name(6)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True,
                             temp_type, None)
Example #29
0
    def test_positive_update_2(self, repo_name):
        """
        @Feature: Content Repo - Positive Update
        @Test: Update Content Repo with gpg key
        @Assert: Repo is updated with new gpg key
        """

        key_path1 = get_data_file(VALID_GPG_KEY_FILE)
        key_path2 = get_data_file(VALID_GPG_KEY_BETA_FILE)
        prd_name = generate_string("alpha", 8)
        gpgkey_name1 = generate_string("alpha", 8)
        gpgkey_name2 = generate_string("alpha", 8)
        locator = locators["repo.fetch_gpgkey"]
        repo_url = "http://inecas.fedorapeople.org/fakerepos/zoo3/"
        description = "test 123"
        with Session(self.browser) as session:
            make_gpgkey(session, self.org_name, self.loc_name,
                        name=gpgkey_name1, upload_key=True, key_path=key_path1)
            self.assertIsNotNone(self.gpgkey.search(gpgkey_name1))
            self.gpgkey.create(gpgkey_name2, upload_key=True,
                               key_path=key_path2)
            self.assertIsNotNone(self.gpgkey.search(gpgkey_name2))
            make_product(session, self.org_name, self.loc_name, name=prd_name,
                         description=description)
            self.assertIsNotNone(self.products.search(prd_name))
            self.repository.create(repo_name, product=prd_name, url=repo_url,
                                   gpg_key=gpgkey_name1)
            self.assertIsNotNone(self.repository.search(repo_name))
            self.repository.search(repo_name).click()
            gpgkey_text1 = self.repository.wait_until_element(locator).text
            self.assertEqual(gpgkey_text1, gpgkey_name1)
            self.navigator.go_to_products()
            self.products.search(prd_name).click()
            self.repository.update(repo_name, new_gpg_key=gpgkey_name2)
            gpgkey_text2 = self.repository.wait_until_element(locator).text
            self.assertEqual(gpgkey_text2, gpgkey_name2)
Example #30
0
    def test_remove_template(self):
        """
        @Feature: Template - Positive Delete
        @Test: Remove a template
        @Assert: Template removed successfully
        """

        name = generate_string("alpha", 6)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True, temp_type, None)
        self.template.delete(name, True)
        self.assertTrue(
            self.template.wait_until_element(common_locators["notif.success"]))
        self.assertIsNone(self.template.search(name))
Example #31
0
    def test_update_template(self):
        """
        @Feature: Template - Positive Update
        @Test: Update template name and template type
        @Assert: The template name and type should be updated successfully
        """

        name = generate_string("alpha", 6)
        new_name = generate_string("alpha", 6)
        temp_type = 'provision'
        new_temp_type = 'PXELinux'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True, temp_type, None)
        self.template.update(name, False, new_name, None, new_temp_type)
        self.assertIsNotNone(self.template.search(new_name))
    def test_update_os_partition_table(self):
        """
        Update OS partition table
        """

        name = generate_name(6)
        major_version = generate_string('numeric', 1)
        ptable = generate_name(4)
        script_file = get_data_file(PARTITION_SCRIPT_DATA_FILE)
        with open(script_file, 'r') as file_contents:
            layout = file_contents.read()
        self.login.login(self.katello_user, self.katello_passwd)  # login
        self.navigator.go_to_partition_tables()
        self.partitiontable.create(ptable, layout)
        self.assertIsNotNone(self.partitiontable.search(ptable))
        self.create_os(name, major_version)
        self.operatingsys.update(name, new_ptables=[ptable])
Example #33
0
    def test_update_template(self):
        """
        @Feature: Template - Positive Update
        @Test: Update template name and template type
        @Assert: The template name and type should be updated successfully
        """

        name = generate_name(6)
        new_name = generate_name(6)
        temp_type = 'provision'
        new_temp_type = 'PXELinux'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True,
                             temp_type, None)
        self.template.update(name, False, new_name, None, new_temp_type)
        self.assertIsNotNone(self.template.search(new_name))
Example #34
0
    def test_remove_template(self):
        """
        @Feature: Template - Positive Delete
        @Test: Remove a template
        @Assert: Template removed successfully
        """

        name = generate_name(6)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True,
                             temp_type, None)
        self.template.delete(name, True)
        self.assertTrue(self.template.wait_until_element(common_locators
                                                         ["notif.success"]))
        self.assertIsNone(self.template.search(name))
Example #35
0
    def test_negative_create_template_5(self):
        """@Test: Template - Create a new template without selecting its type

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        name = gen_string("alpha", 16)
        temp_type = ""
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            with self.assertRaises(Exception) as context:
                make_templates(
                    session, name=name, template_path=template_path, custom_really=True, template_type=temp_type
                )
            self.assertEqual(context.exception.message, "Could not create template '%s'" " without type" % name)
Example #36
0
    def test_positive_create_snippet_template(self, name):
        """@Test: Create new template of type snippet

        @Feature: Template - Positive Create

        @Assert: New provisioning template of type 'snippet'
        should be created successfully

        """
        template_path = get_data_file(SNIPPET_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           snippet=True)
            self.assertIsNotNone(self.template.search(name))
Example #37
0
    def test_update_template(self):
        """@Test: Update template name and template type

        @Feature: Template - Positive Update

        @Assert: The template name and type should be updated successfully

        """
        name = gen_string("alpha", 6)
        new_name = gen_string("alpha", 6)
        temp_type = "provision"
        new_temp_type = "PXELinux"
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path, custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.update(name, False, new_name, None, new_temp_type)
            self.assertIsNotNone(self.template.search(new_name))
Example #38
0
    def test_negative_create_template_with_too_long_name(self):
        """@Test: Template - Create a new template with 256 characters in name

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        with Session(self.browser) as session:
            make_templates(
                session,
                name=gen_string('alpha', 256),
                template_path=get_data_file(OS_TEMPLATE_DATA_FILE),
                custom_really=True,
                template_type='provision',
            )
            self.assertIsNotNone(self.template.wait_until_element
                                 (common_locators['name_haserror']))
    def test_positive_create_template(self, name):
        """@Test: Create new template

        @Feature: Template - Positive Create

        @Assert: New provisioning template of type 'provision'
        should be created successfully

        @BZ: 1129612

        """

        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session, name=name, template_path=template_path,
                           custom_really=True, template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
Example #40
0
    def test_update_os_partition_table(self):
        """@Test: Update OS partition table

        @Feature: OS - Positive Update

        @Assert: OS is updated

        """

        ptable = gen_string("alpha", 4)
        script_file = get_data_file(PARTITION_SCRIPT_DATA_FILE)
        with open(script_file, "r") as file_contents:
            layout = file_contents.read()
        entities.PartitionTable(name=ptable, layout=layout).create_json()
        os_name = entities.OperatingSystem().create_json()["name"]
        with Session(self.browser):
            self.operatingsys.update(os_name, new_ptables=[ptable])
            result_obj = self.operatingsys.get_os_entities(os_name, "ptable")
            self.assertEqual(ptable, result_obj["ptable"])
Example #41
0
    def test_remove_template(self):
        """
        Test:
        Creates new template and removes it

        Expected Result/Assert:
        Created template should be removed successfully
        """

        name = generate_name(6)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        self.login.login(self.katello_user, self.katello_passwd)
        self.create_template(name, template_path, True,
                             temp_type, None)
        self.template.delete(name, True)
        self.assertTrue(self.template.wait_until_element(common_locators
                                                         ["notif.success"]))
        self.assertIsNone(self.template.search(name))
    def test_update_os_template(self):
        """
        Updates Provisioning template
        """

        os_name = generate_name(6)
        major_version = generate_string('numeric', 1)
        template_name = generate_name(4)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        os_list = [os_name]
        self.login.login(self.katello_user, self.katello_passwd)  # login
        self.create_os(os_name, major_version)
        self.navigator.go_to_provisioning_templates()
        self.template.create(template_name, template_path, True,
                             temp_type, None, os_list)
        self.assertIsNotNone(self.template.search(template_name))
        self.navigator.go_to_operating_systems()
        self.operatingsys.update(os_name, template=template_name)
Example #43
0
    def test_negative_create_template_2(self, name):
        """@Test: Create a new template with blank and whitespace in name

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(
                self.template.wait_until_element(
                    common_locators["name_haserror"]))
Example #44
0
    def test_remove_configtemplate_1(self, testdata):
        """
        @test: Remove config template

        @feature: Locations

        @assert: configtemplate is added then removed

        """

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

        template = testdata['user_name']
        strategy, value = common_locators["all_values_selection"]
        loc_name = gen_string("alpha", 8)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=template,
                           template_path=template_path,
                           template_type=temp_type,
                           custom_really=True)
            self.assertIsNotNone(self.template.search(template))
            make_loc(session, name=loc_name)
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element(
                (strategy, value % template))
            # Item is listed in 'Selected Items' list and not 'All Items' list.
            self.assertIsNotNone(element)
            self.template.delete(template, True)
            self.location.search(loc_name).click()
            session.nav.wait_until_element(
                tab_locators["context.tab_template"]).click()
            element = session.nav.wait_until_element(
                (strategy, value % template))
            # Item is listed in 'All Items' list and not 'Selected Items' list.
            self.assertIsNone(element)
Example #45
0
    def test_negative_create_template_7(self):
        """@Test: Create a new template with 256 characters in audit comments

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        name = gen_string("alpha", 16)
        audit_comment = gen_string("alpha", 256)
        temp_type = 'PXELinux'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           audit_comment=audit_comment,
                           template_type=temp_type)
            self.assertIsNotNone(
                self.template.wait_until_element(common_locators["haserror"]))
Example #46
0
    def test_negative_create_template_5(self):
        """@Test: Template - Create a new template without selecting its type

        @Feature: Template - Negative Create

        @Assert: Template is not created

        """
        name = gen_string("alpha", 16)
        temp_type = ""
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            with self.assertRaises(Exception) as context:
                make_templates(session,
                               name=name,
                               template_path=template_path,
                               custom_really=True,
                               template_type=temp_type)
            self.assertEqual(
                context.exception.message, "Could not create template '%s'"
                " without type" % name)
Example #47
0
    def test_update_os_partition_table(self):
        """
        @Feature: OS - Positive Update
        @Test: Update OS partition table
        @Assert: OS is updated
        """

        name = generate_string("alpha", 6)
        major_version = generate_string('numeric', 1)
        ptable = generate_string("alpha", 4)
        script_file = get_data_file(PARTITION_SCRIPT_DATA_FILE)
        with open(script_file, 'r') as file_contents:
            layout = file_contents.read()
        self.login.login(self.katello_user, self.katello_passwd)  # login
        self.navigator.go_to_partition_tables()
        self.partitiontable.create(ptable, layout)
        self.assertIsNotNone(self.partitiontable.search(ptable))
        self.create_os(name, major_version)
        self.operatingsys.update(name, new_ptables=[ptable])
        result_object = self.operatingsys.get_os_entities(name, "ptable")
        self.assertEqual(ptable, result_object['ptable'])
Example #48
0
    def test_update_os_partition_table(self):
        """@Test: Update OS partition table

        @Feature: OS - Positive Update

        @Assert: OS is updated

        """

        ptable = gen_string("alpha", 4)
        script_file = get_data_file(PARTITION_SCRIPT_DATA_FILE)
        with open(script_file, 'r') as file_contents:
            layout = file_contents.read()
        entities.PartitionTable(
            name=ptable,
            layout=layout,
        ).create()
        os_name = entities.OperatingSystem().create()['name']
        with Session(self.browser):
            self.operatingsys.update(os_name, new_ptables=[ptable])
            result_obj = self.operatingsys.get_os_entities(os_name, "ptable")
            self.assertEqual(ptable, result_obj['ptable'])
Example #49
0
    def test_update_template(self):
        """@Test: Update template name and template type

        @Feature: Template - Positive Update

        @Assert: The template name and type should be updated successfully

        """
        name = gen_string("alpha", 6)
        new_name = gen_string("alpha", 6)
        temp_type = 'provision'
        new_temp_type = 'PXELinux'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        with Session(self.browser) as session:
            make_templates(session,
                           name=name,
                           template_path=template_path,
                           custom_really=True,
                           template_type=temp_type)
            self.assertIsNotNone(self.template.search(name))
            self.template.update(name, False, new_name, None, new_temp_type)
            self.assertIsNotNone(self.template.search(new_name))
Example #50
0
    def test_update_os_template(self):
        """
        @Feature: OS - Positive Update
        @Test: Update provisioning template
        @Assert: OS is updated
        """

        os_name = generate_string("alpha", 6)
        major_version = generate_string('numeric', 1)
        template_name = generate_string("alpha", 4)
        temp_type = 'provision'
        template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
        os_list = [os_name]
        self.login.login(self.katello_user, self.katello_passwd)  # login
        self.create_os(os_name, major_version)
        self.navigator.go_to_provisioning_templates()
        self.template.create(template_name, template_path, True,
                             temp_type, None, os_list)
        self.assertIsNotNone(self.template.search(template_name))
        self.navigator.go_to_operating_systems()
        self.operatingsys.update(os_name, template=template_name)
        result_object = self.operatingsys.get_os_entities(os_name, "template")
        self.assertEqual(template_name, result_object['template'])
Example #51
0
    def test_update_contents(self):
        """@Test: Create a repository and upload RPM contents.

        @Assert: The repository's contents include one RPM.

        @Feature: Repository

        """
        # Create a repository and upload RPM content.
        repo_id = entities.Repository(product=self.prod_id).create()['id']
        client.post(
            entities.Repository(id=repo_id).path(which='upload_content'),
            {},
            auth=get_server_credentials(),
            files={
                u'content': open(get_data_file(RPM_TO_UPLOAD), 'rb')
            },
            verify=False,
        ).raise_for_status()

        # Verify the repository's contents.
        attrs = entities.Repository(id=repo_id).read_json()
        self.assertEqual(attrs[u'content_counts'][u'rpm'], 1)
Example #52
0
 def test_update_template_os(self):
     """
     @Feature: Template - Positive Update
     @Test: Creates new template, along with two OS's
     and associate list of OS's with created template
     @Assert: The template should be updated with newly created OS's
     successfully
     """
     name = generate_string("alpha", 6)
     new_name = generate_string("alpha", 6)
     temp_type = 'provision'
     os_name1 = generate_string("alpha", 6)
     os_name2 = generate_string("alpha", 6)
     os_list = [os_name1, os_name2]
     major_version = generate_string('numeric', 1)
     template_path = get_data_file(OS_TEMPLATE_DATA_FILE)
     self.login.login(self.katello_user, self.katello_passwd)
     for os_name in os_list:
         self.navigator.go_to_operating_systems()
         self.operatingsys.create(os_name, major_version)
         self.assertIsNotNone(self.operatingsys.search(os_name))
     self.create_template(name, template_path, True, temp_type, None)
     self.template.update(name, False, new_name, new_os_list=os_list)
     self.assertIsNotNone(self.template.search(new_name))
Example #53
0
Test class for GPG Key CLI
"""

from ddt import ddt
from robottelo.cli.factory import make_gpg_key, make_org
from robottelo.cli.gpgkey import GPGKey
from robottelo.cli.org import Org
from robottelo.common import ssh
from robottelo.common.constants import VALID_GPG_KEY_FILE
from robottelo.common.decorators import data, redminebug, stubbed
from robottelo.common.helpers import (generate_name, generate_string,
                                      get_data_file)
from tempfile import mkstemp
from tests.foreman.cli.basecli import BaseCLI

VALID_GPG_KEY_FILE_PATH = get_data_file(VALID_GPG_KEY_FILE)


def positive_create_data():
    """Random data for positive creation"""

    return (
        {
            'name': generate_string("latin1", 10)
        },
        {
            'name': generate_string("utf8", 10)
        },
        {
            'name': generate_string("alpha", 10)
        },