Exemplo n.º 1
0
    def test_positive_update_gpg(self):
        """Create a product and update its GPGKey

        @id: 3b08f155-a0d6-4987-b281-dc02e8d5a03e

        @Assert: The updated product points to a new GPG key.

        @CaseLevel: Integration
        """
        # Create a product and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        product = entities.Product(
            gpg_key=gpg_key_1, organization=self.org).create()

        # Update the product and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        product.gpg_key = gpg_key_2
        product = product.update()
        self.assertEqual(product.gpg_key.id, gpg_key_2.id)
Exemplo n.º 2
0
    def test_positive_update_gpg(self):
        """Create a repository and update its GPGKey

        @Assert: The updated repository points to a new GPG key.

        @Feature: Repository
        """
        # Create a repo and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key_1,
            product=self.product,
        ).create()

        # Update the repo and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        repo.gpg_key = gpg_key_2
        repo = repo.update()
        self.assertEqual(repo.gpg_key.id, gpg_key_2.id)
Exemplo n.º 3
0
    def test_positive_update_gpg(self):
        """Create a repository and update its GPGKey

        @id: 0e9319dc-c922-4ecf-9f83-d221cfdf54c2

        @Assert: The updated repository points to a new GPG key.

        @CaseLevel: Integration
        """
        # Create a repo and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key_1,
            product=self.product,
        ).create()

        # Update the repo and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        repo.gpg_key = gpg_key_2
        repo = repo.update()
        self.assertEqual(repo.gpg_key.id, gpg_key_2.id)
Exemplo n.º 4
0
    def test_positive_update_gpg(self):
        """Create a repository and update its GPGKey

        @id: 0e9319dc-c922-4ecf-9f83-d221cfdf54c2

        @Assert: The updated repository points to a new GPG key.

        @CaseLevel: Integration
        """
        # Create a repo and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key_1,
            product=self.product,
        ).create()

        # Update the repo and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        repo.gpg_key = gpg_key_2
        repo = repo.update()
        self.assertEqual(repo.gpg_key.id, gpg_key_2.id)
Exemplo n.º 5
0
    def test_positive_update_gpg(self):
        """Create a product and update its GPGKey

        :id: 3b08f155-a0d6-4987-b281-dc02e8d5a03e

        :expectedresults: The updated product points to a new GPG key.

        :CaseLevel: Integration
        """
        # Create a product and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        product = entities.Product(gpg_key=gpg_key_1,
                                   organization=self.org).create()

        # Update the product and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        product.gpg_key = gpg_key_2
        product = product.update()
        self.assertEqual(product.gpg_key.id, gpg_key_2.id)
Exemplo n.º 6
0
    def test_positive_update_gpg(self):
        """Create a repository and update its GPGKey

        @Assert: The updated repository points to a new GPG key.

        @Feature: Repository
        """
        # Create a repo and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key_1,
            product=self.product,
        ).create()

        # Update the repo and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        repo.gpg_key = gpg_key_2
        repo = repo.update()
        self.assertEqual(repo.gpg_key.id, gpg_key_2.id)
Exemplo n.º 7
0
def test_positive_end_to_end_custom_yum_crud(session, module_org, module_prod):
    """Perform end to end testing for custom yum repository

    :id: 8baf11c9-019e-4625-a549-ec4cd9312f75

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: High
    """
    repo_name = gen_string('alpha')
    checksum_type = 'sha256'
    new_repo_name = gen_string('alphanumeric')
    new_checksum_type = 'sha1'
    gpg_key = entities.GPGKey(
        content=read_data_file(VALID_GPG_KEY_FILE), organization=module_org
    ).create()
    new_gpg_key = entities.GPGKey(
        content=read_data_file(VALID_GPG_KEY_BETA_FILE), organization=module_org
    ).create()
    with session:
        session.repository.create(
            module_prod.name,
            {
                'name': repo_name,
                'repo_type': REPO_TYPE['yum'],
                'repo_content.upstream_url': settings.repos.yum_1.url,
                'repo_content.checksum_type': checksum_type,
                'repo_content.gpg_key': gpg_key.name,
                'repo_content.download_policy': DOWNLOAD_POLICIES['immediate'],
            },
        )
        assert session.repository.search(module_prod.name, repo_name)[0]['Name'] == repo_name
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert repo_values['repo_content']['upstream_url'] == settings.repos.yum_1.url
        assert repo_values['repo_content']['metadata_type'] == checksum_type
        assert repo_values['repo_content']['gpg_key'] == gpg_key.name
        assert repo_values['repo_content']['download_policy'] == DOWNLOAD_POLICIES['immediate']
        session.repository.update(
            module_prod.name,
            repo_name,
            {
                'name': new_repo_name,
                'repo_content.upstream_url': settings.repos.yum_2.url,
                'repo_content.metadata_type': new_checksum_type,
                'repo_content.gpg_key': new_gpg_key.name,
                'repo_content.download_policy': DOWNLOAD_POLICIES['immediate'],
            },
        )
        assert not session.repository.search(module_prod.name, repo_name)
        repo_values = session.repository.read(module_prod.name, new_repo_name)
        assert repo_values['name'] == new_repo_name
        assert repo_values['repo_content']['upstream_url'] == settings.repos.yum_2.url
        assert repo_values['repo_content']['metadata_type'] == new_checksum_type
        assert repo_values['repo_content']['gpg_key'] == new_gpg_key.name
        assert repo_values['repo_content']['download_policy'] == DOWNLOAD_POLICIES['immediate']
        session.repository.delete(module_prod.name, new_repo_name)
        assert not session.repository.search(module_prod.name, new_repo_name)
Exemplo n.º 8
0
    def test_update_partition_table(self):
        """@Test: Update partition table with its name, layout and OS family

        @Feature: Partition table - Positive Update

        @Assert: Partition table is updated

        """
        name = gen_string('alphanumeric')
        with Session(self.browser) as session:
            make_partitiontable(
                session,
                name=name,
                layout='test layout',
                os_family='Debian',
            )
            self.assertIsNotNone(self.partitiontable.search(name))
            for test_data in valid_partition_table_update_names():
                with self.subTest(test_data):
                    bug_id = test_data.pop('bugzilla', None)
                    if bug_id is not None and bz_bug_is_open(bug_id):
                        self.skipTest(
                            'Bugzilla bug {0} is open for html '
                            'data.'.format(bug_id)
                        )
                        self.partitiontable.update(
                            name,
                            test_data['new_name'],
                            read_data_file(PARTITION_SCRIPT_DATA_FILE),
                            'Red Hat',
                        )
                        self.assertIsNotNone(self.partitiontable.search(
                            test_data['new_name']))
                        name = test_data['new_name']  # for next iteration
Exemplo n.º 9
0
    def test_update_partition_table(self, test_data):
        """@Test: Update partition table with its name, layout and OS family

        @Feature: Partition table - Positive Update

        @Assert: Partition table is updated

        """
        bug_id = test_data.pop('bugzilla', None)
        if bug_id is not None and bz_bug_is_open(bug_id):
            self.skipTest(
                'Bugzilla bug {0} is open for html data.'.format(bug_id)
            )
        with Session(self.browser) as session:
            make_partitiontable(
                session,
                name=test_data['name'],
                layout='test layout',
                os_family='Debian',
            )
            self.assertIsNotNone(self.partitiontable.search(test_data['name']))
            self.partitiontable.update(
                test_data['name'],
                test_data['new_name'],
                read_data_file(PARTITION_SCRIPT_DATA_FILE),
                'Red Hat',
            )
            self.assertIsNotNone(self.partitiontable.search
                                 (test_data['new_name']))
Exemplo n.º 10
0
    def test_positive_update_gpg(self):
        """Create a product and update its GPGKey

        @Assert: The updated product points to a new GPG key.

        @Feature: Product
        """
        # Create a product and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE), organization=self.org).create()
        product = entities.Product(gpg_key=gpg_key_1, organization=self.org).create()

        # Update the product and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_BETA_FILE), organization=self.org).create()
        product.gpg_key = gpg_key_2
        product = product.update()
        self.assertEqual(product.gpg_key.id, gpg_key_2.id)
Exemplo n.º 11
0
def test_positive_end_to_end(session, module_org):
    """Perform end to end testing for product component

    :id: d0e1f0d1-2380-4508-b270-62c1d8b3e2ff

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: Critical
    """
    product_name = gen_string('alpha')
    new_product_name = gen_string('alpha')
    product_label = gen_string('alpha')
    product_description = gen_string('alpha')
    gpg_key = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE),
                              organization=module_org).create()
    sync_plan = entities.SyncPlan(organization=module_org).create()
    with session:
        # Create new product using different parameters
        session.product.create({
            'name': product_name,
            'label': product_label,
            'gpg_key': gpg_key.name,
            'sync_plan': sync_plan.name,
            'description': product_description,
        })
        assert session.product.search(product_name)[0]['Name'] == product_name
        # Verify that created entity has expected parameters
        product_values = session.product.read(product_name)
        assert product_values['details']['name'] == product_name
        assert product_values['details']['label'] == product_label
        assert product_values['details']['gpg_key'] == gpg_key.name
        assert product_values['details']['description'] == product_description
        assert product_values['details']['sync_plan'] == sync_plan.name
        # Update a product with a different name
        session.product.update(product_name,
                               {'details.name': new_product_name})
        assert session.product.search(product_name)[0]['Name'] != product_name
        assert session.product.search(
            new_product_name)[0]['Name'] == new_product_name
        # Add a repo to product
        session.repository.create(
            new_product_name,
            {
                'name': gen_string('alpha'),
                'repo_type': REPO_TYPE['yum'],
                'repo_content.upstream_url': FAKE_1_YUM_REPO,
            },
        )
        # Synchronize the product
        result = session.product.synchronize(new_product_name)
        assert result['result'] == 'success'
        product_values = session.product.read(new_product_name)
        assert product_values['details']['repos_count'] == '1'
        assert product_values['details']['sync_state'] == 'Syncing Complete.'
        # Delete product
        session.product.delete(new_product_name)
        assert session.product.search(
            new_product_name)[0]['Name'] != new_product_name
Exemplo n.º 12
0
    def test_positive_create_with_gpg(self):
        """Create a repository and provide a GPG key ID.

        @Assert: A repository is created with the given GPG key ID.

        @Feature: Repository
        """
        gpg_key = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE), organization=self.org).create()
        repo = entities.Repository(gpg_key=gpg_key, product=self.product).create()
        # Verify that the given GPG key ID is used.
        self.assertEqual(gpg_key.id, repo.gpg_key.id)
Exemplo n.º 13
0
    def test_positive_update_GPG(self, repo_name):
        """@Test: Update content repository with new gpg-key

        @Feature: Content Repo - Positive Update

        @Assert: Repo is updated with new gpg key

        """
        key_1_content = read_data_file(VALID_GPG_KEY_FILE)
        key_2_content = read_data_file(VALID_GPG_KEY_BETA_FILE)
        # Create two new GPGKey's
        gpgkey_1 = entities.GPGKey(
            content=key_1_content,
            organization=self.organization,
        ).create()
        gpgkey_2 = entities.GPGKey(
            content=key_2_content,
            organization=self.organization,
        ).create()

        product = entities.Product(organization=self.organization).create()
        with Session(self.browser) as session:
            make_repository(
                session,
                org=self.organization.name,
                name=repo_name,
                product=product.name,
                url=FAKE_1_YUM_REPO,
                gpg_key=gpgkey_1.name,
            )
            self.assertIsNotNone(self.repository.search(repo_name))
            self.assertTrue(self.repository.validate_field(
                repo_name, 'gpgkey', gpgkey_1.name))
            self.navigator.go_to_products()
            self.products.search(product.name).click()
            self.repository.update(repo_name, new_gpg_key=gpgkey_2.name)
            self.navigator.go_to_products()
            self.products.search(product.name).click()
            self.assertTrue(self.repository.validate_field(
                repo_name, 'gpgkey', gpgkey_2.name))
Exemplo n.º 14
0
    def test_positive_update_gpg(self):
        """Update content repository with new gpg-key

        @Feature: Content Repo - Positive Update

        @Assert: Repository is updated with new gpg key
        """
        repo_name = gen_string('alphanumeric')
        key_1_content = read_data_file(VALID_GPG_KEY_FILE)
        key_2_content = read_data_file(VALID_GPG_KEY_BETA_FILE)
        # Create two new GPGKey's
        gpgkey_1 = entities.GPGKey(
            content=key_1_content,
            organization=self.organization,
        ).create()
        gpgkey_2 = entities.GPGKey(
            content=key_2_content,
            organization=self.organization,
        ).create()
        product = entities.Product(organization=self.organization).create()
        with Session(self.browser) as session:
            set_context(session, org=self.organization.name)
            self.products.search(product.name).click()
            make_repository(
                session,
                name=repo_name,
                url=FAKE_1_YUM_REPO,
                gpg_key=gpgkey_1.name,
            )
            self.assertIsNotNone(self.repository.search(repo_name))
            self.assertTrue(
                self.repository.validate_field(repo_name, 'gpgkey',
                                               gpgkey_1.name))
            self.products.search(product.name).click()
            self.repository.update(repo_name, new_gpg_key=gpgkey_2.name)
            self.products.search(product.name).click()
            self.assertTrue(
                self.repository.validate_field(repo_name, 'gpgkey',
                                               gpgkey_2.name))
Exemplo n.º 15
0
    def test_positive_update_gpg(self):
        """Create a product and update its GPGKey

        @Assert: The updated product points to a new GPG key.

        @Feature: Product
        """
        # Create a product and make it point to a GPG key.
        gpg_key_1 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        product = entities.Product(
            gpg_key=gpg_key_1, organization=self.org).create()

        # Update the product and make it point to a new GPG key.
        gpg_key_2 = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
            organization=self.org,
        ).create()
        product.gpg_key = gpg_key_2
        product = product.update()
        self.assertEqual(product.gpg_key.id, gpg_key_2.id)
Exemplo n.º 16
0
    def test_positive_create_with_gpg(self):
        """Create a product and provide a GPG key.

        @Assert: A product is created with the specified GPG key.

        @Feature: Product
        """
        # Create an organization, GPG key and product.
        #
        # product -----------↘
        #       `-→ gpg_key → organization
        gpg_key = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE), organization=self.org).create()
        product = entities.Product(gpg_key=gpg_key, organization=self.org).create()
        self.assertEqual(product.gpg_key.id, gpg_key.id)
Exemplo n.º 17
0
    def test_positive_update_content(self):
        """Update GPG key content text to another valid one.

        @Assert: The GPG key content text can be updated.

        @Feature: GPGKey
        """
        gpg_key = entities.GPGKey(
            organization=self.org,
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
        ).create()
        gpg_key.content = self.key_content
        gpg_key = gpg_key.update(['content'])
        self.assertEqual(self.key_content, gpg_key.content)
Exemplo n.º 18
0
def test_positive_create_with_gpg(module_org):
    """Create a product and provide a GPG key.

    :id: 57331c1f-15dd-4c9f-b8fc-3010847b2975

    :expectedresults: A product is created with the specified GPG key.

    :CaseLevel: Integration
    """
    gpg_key = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE),
                              organization=module_org).create()
    product = entities.Product(gpg_key=gpg_key,
                               organization=module_org).create()
    assert product.gpg_key.id == gpg_key.id
Exemplo n.º 19
0
    def test_positive_update_content(self):
        """Update GPG key content text to another valid one.

        @id: 62fdaf55-c931-4be6-9857-68cc816046ad

        @Assert: The GPG key content text can be updated.
        """
        gpg_key = entities.GPGKey(
            organization=self.org,
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
        ).create()
        gpg_key.content = self.key_content
        gpg_key = gpg_key.update(['content'])
        self.assertEqual(self.key_content, gpg_key.content)
Exemplo n.º 20
0
    def test_positive_update_content(self):
        """Update GPG key content text to another valid one.

        @id: 62fdaf55-c931-4be6-9857-68cc816046ad

        @Assert: The GPG key content text can be updated.
        """
        gpg_key = entities.GPGKey(
            organization=self.org,
            content=read_data_file(VALID_GPG_KEY_BETA_FILE),
        ).create()
        gpg_key.content = self.key_content
        gpg_key = gpg_key.update(['content'])
        self.assertEqual(self.key_content, gpg_key.content)
Exemplo n.º 21
0
    def test_positive_update_gpg(self):
        """Update content repository with new gpg-key

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

        @Assert: Repository is updated with new gpg key
        """
        repo_name = gen_string('alphanumeric')
        key_1_content = read_data_file(VALID_GPG_KEY_FILE)
        key_2_content = read_data_file(VALID_GPG_KEY_BETA_FILE)
        # Create two new GPGKey's
        gpgkey_1 = entities.GPGKey(
            content=key_1_content,
            organization=self.organization,
        ).create()
        gpgkey_2 = entities.GPGKey(
            content=key_2_content,
            organization=self.organization,
        ).create()
        product = entities.Product(organization=self.organization).create()
        with Session(self.browser) as session:
            set_context(session, org=self.organization.name)
            self.products.search(product.name).click()
            make_repository(
                session,
                name=repo_name,
                url=FAKE_1_YUM_REPO,
                gpg_key=gpgkey_1.name,
            )
            self.assertIsNotNone(self.repository.search(repo_name))
            self.assertTrue(self.repository.validate_field(
                repo_name, 'gpgkey', gpgkey_1.name))
            self.products.search(product.name).click()
            self.repository.update(repo_name, new_gpg_key=gpgkey_2.name)
            self.products.search(product.name).click()
            self.assertTrue(self.repository.validate_field(
                repo_name, 'gpgkey', gpgkey_2.name))
Exemplo n.º 22
0
    def test_positive_delete(self):
        """Create content view and publish it. After that try to
        disassociate content view from 'Library' environment through
        'delete_from_environment' command and delete content view version from
        that content view. Add repository and gpg key to initial content view
        for better coverage

        :id: 066dec47-c942-4c01-8956-359c8b23a6d4

        :expectedresults: Content version deleted successfully

        :CaseLevel: Integration

        :CaseImportance: Critical
        """
        key_content = read_data_file(ZOO_CUSTOM_GPG_KEY)
        org = entities.Organization().create()
        gpgkey = entities.GPGKey(
            content=key_content,
            organization=org,
        ).create()
        # Creates new product without selecting GPGkey
        product = entities.Product(organization=org).create()
        # Creates new repository with GPGKey
        repo = entities.Repository(
            gpg_key=gpgkey,
            product=product,
            url=FAKE_1_YUM_REPO,
        ).create()
        # sync repository
        repo.sync()
        # Create content view
        content_view = entities.ContentView(organization=org).create()
        # Associate repository to new content view
        content_view.repository = [repo]
        content_view = content_view.update(['repository'])
        # Publish content view
        content_view.publish()
        content_view = content_view.read()
        # Get published content-view version id
        self.assertEqual(len(content_view.version), 1)
        cvv = content_view.version[0].read()
        self.assertEqual(len(cvv.environment), 1)
        # Delete the content-view version from selected env
        content_view.delete_from_environment(cvv.environment[0].id)
        # Delete the version
        content_view.version[0].delete()
        # Make sure that content view version is really removed
        self.assertEqual(len(content_view.read().version), 0)
Exemplo n.º 23
0
def test_positive_update_content(module_org):
    """Update GPG key content text to another valid one.

    :id: 62fdaf55-c931-4be6-9857-68cc816046ad

    :expectedresults: The GPG key content text can be updated.

    :CaseImportance: Critical
    """
    gpg_key = entities.GPGKey(
        organization=module_org,
        content=read_data_file(VALID_GPG_KEY_BETA_FILE)).create()
    gpg_key.content = key_content
    gpg_key = gpg_key.update(['content'])
    assert key_content == gpg_key.content
Exemplo n.º 24
0
    def test_positive_create_partition_table(self, name):
        """@Test: Create a new partition table

        @Feature: Partition table - Positive Create

        @Assert: Partition table is created

        """
        with Session(self.browser) as session:
            make_partitiontable(
                session,
                name=name,
                layout=read_data_file(PARTITION_SCRIPT_DATA_FILE),
                os_family='Red Hat'
            )
            self.assertIsNotNone(self.partitiontable.search(name))
Exemplo n.º 25
0
    def test_positive_delete(self):
        """Create content view and publish it. After that try to
        disassociate content view from 'Library' environment through
        'delete_from_environment' command and delete content view version from
        that content view. Add repository and gpg key to initial content view
        for better coverage

        :id: 066dec47-c942-4c01-8956-359c8b23a6d4

        :expectedresults: Content version deleted successfully

        :CaseLevel: Integration
        """
        key_content = read_data_file(ZOO_CUSTOM_GPG_KEY)
        org = entities.Organization().create()
        gpgkey = entities.GPGKey(
            content=key_content,
            organization=org,
        ).create()
        # Creates new product without selecting GPGkey
        product = entities.Product(organization=org).create()
        # Creates new repository with GPGKey
        repo = entities.Repository(
            gpg_key=gpgkey,
            product=product,
            url=FAKE_1_YUM_REPO,
        ).create()
        # sync repository
        repo.sync()
        # Create content view
        content_view = entities.ContentView(organization=org).create()
        # Associate repository to new content view
        content_view.repository = [repo]
        content_view = content_view.update(['repository'])
        # Publish content view
        content_view.publish()
        content_view = content_view.read()
        # Get published content-view version id
        self.assertEqual(len(content_view.version), 1)
        cvv = content_view.version[0].read()
        self.assertEqual(len(cvv.environment), 1)
        # Delete the content-view version from selected env
        content_view.delete_from_environment(cvv.environment[0].id)
        # Delete the version
        content_view.version[0].delete()
        # Make sure that content view version is really removed
        self.assertEqual(len(content_view.read().version), 0)
Exemplo n.º 26
0
def test_positive_product_create_with_create_sync_plan(session, module_org):
    """Perform Sync Plan Create from Product Create Page

    :id: 4a87b533-12b6-4d4e-8a99-4bb95efc4321

    :expectedresults: Ensure sync get created and assigned to Product.

    :CaseLevel: Integration

    :CaseImportance: Medium
    """
    product_name = gen_string('alpha')
    product_description = gen_string('alpha')
    gpg_key = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE),
                              organization=module_org).create()
    plan_name = gen_string('alpha')
    description = gen_string('alpha')
    cron_expression = gen_choice(valid_cron_expressions())
    with session:
        session.organization.select(module_org.name)
        startdate = session.browser.get_client_datetime() + timedelta(
            minutes=10)
        sync_plan_values = {
            'name': plan_name,
            'interval': SYNC_INTERVAL['custom'],
            'description': description,
            'cron_expression': cron_expression,
            'date_time.start_date': startdate.strftime("%Y-%m-%d"),
            'date_time.hours': startdate.strftime('%H'),
            'date_time.minutes': startdate.strftime('%M'),
        }
        session.product.create(
            {
                'name': product_name,
                'gpg_key': gpg_key.name,
                'description': product_description
            },
            sync_plan_values=sync_plan_values,
        )
        assert session.product.search(product_name)[0]['Name'] == product_name
        product_values = session.product.read(product_name,
                                              widget_names='details')
        assert product_values['details']['name'] == product_name
        assert product_values['details']['sync_plan'] == plan_name
        # Delete product
        session.product.delete(product_name)
        assert session.product.search(product_name)[0]['Name'] != product_name
Exemplo n.º 27
0
    def test_positive_create_with_name(self):
        """@Test: Create a new partition table

        @Feature: Partition table - Positive Create

        @Assert: Partition table is created
        """
        with Session(self.browser) as session:
            for name in generate_strings_list(length=10):
                with self.subTest(name):
                    make_partitiontable(
                        session,
                        name=name,
                        layout=read_data_file(PARTITION_SCRIPT_DATA_FILE),
                        os_family='Red Hat'
                    )
                    self.assertIsNotNone(self.partitiontable.search(name))
Exemplo n.º 28
0
    def test_negative_create_partition_table_with_empty_name(self, name):
        """@Test: Create partition table with blank and whitespace in name

        @Feature: Partition table - Negative Create

        @Assert: Partition table is not created

        """
        with Session(self.browser) as session:
            make_partitiontable(
                session,
                name=name,
                layout=read_data_file(PARTITION_SCRIPT_DATA_FILE),
                os_family='Red Hat'
            )
            self.assertIsNotNone(self.partitiontable.wait_until_element
                                 (common_locators['name_haserror']))
Exemplo n.º 29
0
    def test_positive_create_with_gpg(self):
        """Create a repository and provide a GPG key ID.

        @Assert: A repository is created with the given GPG key ID.

        @Feature: Repository
        """
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key,
            product=self.product,
        ).create()
        # Verify that the given GPG key ID is used.
        self.assertEqual(gpg_key.id, repo.gpg_key.id)
Exemplo n.º 30
0
    def test_positive_create_with_gpg(self):
        """Create a product and provide a GPG key.

        :id: 57331c1f-15dd-4c9f-b8fc-3010847b2975

        :expectedresults: A product is created with the specified GPG key.

        :CaseLevel: Integration
        """
        # Create an organization, GPG key and product.
        #
        # product -----------↘
        #       `-→ gpg_key → organization
        gpg_key = entities.GPGKey(content=read_data_file(VALID_GPG_KEY_FILE),
                                  organization=self.org).create()
        product = entities.Product(gpg_key=gpg_key,
                                   organization=self.org).create()
        self.assertEqual(product.gpg_key.id, gpg_key.id)
Exemplo n.º 31
0
    def test_positive_create_with_gpg(self):
        """Create a product and provide a GPG key.

        @Assert: A product is created with the specified GPG key.

        @Feature: Product
        """
        # Create an organization, GPG key and product.
        #
        # product -----------↘
        #       `-→ gpg_key → organization
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        product = entities.Product(
            gpg_key=gpg_key, organization=self.org).create()
        self.assertEqual(product.gpg_key.id, gpg_key.id)
Exemplo n.º 32
0
    def test_negative_create_with_same_name(self):
        """@Test: Create a new partition table with same name

        @Feature: Partition table - Negative Create

        @Assert: Partition table is not created
        """
        name = gen_string('utf8')
        layout = read_data_file(PARTITION_SCRIPT_DATA_FILE)
        os_family = 'Red Hat'
        with Session(self.browser) as session:
            make_partitiontable(
                session, name=name, layout=layout, os_family=os_family)
            self.assertIsNotNone(self.partitiontable.search(name))
            make_partitiontable(
                session, name=name, layout=layout, os_family=os_family)
            self.assertIsNotNone(self.partitiontable.wait_until_element
                                 (common_locators['name_haserror']))
Exemplo n.º 33
0
def test_positive_product_create_with_create_sync_plan(session, module_org):
    """Perform Sync Plan Create from Product Create Page

    :id: 4a87b533-12b6-4d4e-8a99-4bb95efc4321

    :expectedresults: Ensure sync get created and assigned to Product.

    :CaseLevel: Integration

    :CaseImportance: medium
    """
    product_name = gen_string('alpha')
    product_description = gen_string('alpha')
    gpg_key = entities.GPGKey(
        content=read_data_file(VALID_GPG_KEY_FILE),
        organization=module_org
    ).create()
    plan_name = gen_string('alpha')
    description = gen_string('alpha')
    cron_expression = gen_choice(valid_cron_expressions())
    with session:
        startdate = (
                session.browser.get_client_datetime() + timedelta(minutes=10))
        sync_plan_values = {
            'name': plan_name,
            'interval': SYNC_INTERVAL['custom'],
            'description': description,
            'cron_expression': cron_expression,
            'date_time.start_date': startdate.strftime("%Y-%m-%d"),
            'date_time.hours': startdate.strftime('%H'),
            'date_time.minutes': startdate.strftime('%M'),
        }
        session.product.create({
            'name': product_name,
            'gpg_key': gpg_key.name,
            'description': product_description,
        }, sync_plan_values=sync_plan_values)
        assert session.product.search(product_name)[0]['Name'] == product_name
        product_values = session.product.read(product_name)
        assert product_values['details']['name'] == product_name
        assert product_values['details']['sync_plan'] == plan_name
        # Delete product
        session.product.delete(product_name)
        assert not session.product.search(product_name)
Exemplo n.º 34
0
    def test_delete_version_default(self):
        """@Test: Delete a content-view version associated to 'Library'

        @Assert: Deletion fails

        @Feature: ContentViewVersion

        """
        key_content = read_data_file(ZOO_CUSTOM_GPG_KEY)
        org = entities.Organization().create()
        gpgkey = entities.GPGKey(
            content=key_content,
            organization=org,
        ).create()
        # Creates new product without selecting GPGkey
        product = entities.Product(organization=org).create()
        # Creates new repository with GPGKey
        repo = entities.Repository(
            url=FAKE_1_YUM_REPO,
            gpg_key=gpgkey,
            product=product,
        ).create()
        # sync repository
        repo.sync()
        # Create content view
        cv = entities.ContentView(organization=org).create()
        cv.repository = [repo]
        cv = cv.update(['repository'])
        self.assertEqual(len(cv.repository), 1)
        # Publish content view
        cv.publish()
        # Get published content-view version info
        cv_info = entities.ContentView(id=cv.id).read_json()
        self.assertEqual(len(cv_info['versions']), 1)
        # API returns version like '1.0'
        version_num = cv_info['versions'][0]['version']
        # WebUI displays version like 'Version 1.0'
        version = 'Version {0}'.format(version_num)
        with Session(self.browser) as session:
            session.nav.go_to_select_org(org.name)
            session.nav.go_to_content_views()
            self.content_views.delete_version(cv.name, version)
            self.content_views.check_progress_bar_status(version)
            self.content_views.validate_version_deleted(cv.name, version)
Exemplo n.º 35
0
    def test_positive_create_with_gpg(self):
        """Create a repository and provide a GPG key ID.

        @id: 023cf84b-74f3-4e63-a9d7-10afee6c1990

        @Assert: A repository is created with the given GPG key ID.

        @CaseLevel: Integration
        """
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key,
            product=self.product,
        ).create()
        # Verify that the given GPG key ID is used.
        self.assertEqual(gpg_key.id, repo.gpg_key.id)
Exemplo n.º 36
0
    def test_positive_create_with_gpg(self):
        """Create a repository and provide a GPG key ID.

        @id: 023cf84b-74f3-4e63-a9d7-10afee6c1990

        @Assert: A repository is created with the given GPG key ID.

        @CaseLevel: Integration
        """
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key,
            product=self.product,
        ).create()
        # Verify that the given GPG key ID is used.
        self.assertEqual(gpg_key.id, repo.gpg_key.id)
Exemplo n.º 37
0
    def test_positive_create_with_gpg(self):
        """Create a product and provide a GPG key.

        @id: 57331c1f-15dd-4c9f-b8fc-3010847b2975

        @Assert: A product is created with the specified GPG key.

        @CaseLevel: Integration
        """
        # Create an organization, GPG key and product.
        #
        # product -----------↘
        #       `-→ gpg_key → organization
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        product = entities.Product(
            gpg_key=gpg_key, organization=self.org).create()
        self.assertEqual(product.gpg_key.id, gpg_key.id)
Exemplo n.º 38
0
    def test_negative_create_with_invalid_name(self):
        """@Test: Create partition table with invalid names

        @Feature: Partition table - Negative Create

        @Assert: Partition table is not created
        """
        with Session(self.browser) as session:
            for name in invalid_values_list(interface='ui'):
                with self.subTest(name):
                    make_partitiontable(
                        session,
                        name=name,
                        layout=read_data_file(PARTITION_SCRIPT_DATA_FILE),
                        os_family='Red Hat'
                    )
                    self.assertIsNotNone(
                        self.partitiontable.wait_until_element(
                            common_locators['name_haserror'])
                    )
Exemplo n.º 39
0
    def test_positive_create_2(self):
        """@Test: Create a product and provide a GPG key.

        @Assert: A product is created with the specified GPG key.

        @Feature: Product

        """
        # Create an organization, GPG key and product.
        #
        # product -----------↘
        #       `-→ gpg_key → organization
        #
        # Re-using an organization speeds up the test.
        org = entities.Organization().create()
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=org,
        ).create()
        product = entities.Product(gpg_key=gpg_key, organization=org).create()
        self.assertEqual(product.gpg_key.id, gpg_key.id)
Exemplo n.º 40
0
    def test_positive_create_with_gpg(self):
        """Create a repository and provide a GPG key ID.

        @Assert: A repository is created with the given GPG key ID.

        @Feature: Repository
        """
        # Create this dependency tree:
        #
        # repository -> product -.
        #           `-> gpg key --`-> organization
        #
        gpg_key = entities.GPGKey(
            content=read_data_file(VALID_GPG_KEY_FILE),
            organization=self.org,
        ).create()
        repo = entities.Repository(
            gpg_key=gpg_key,
            product=self.product,
        ).create()

        # Verify that the given GPG key ID is used.
        self.assertEqual(gpg_key.id, repo.read().gpg_key.id)
Exemplo n.º 41
0
 def setUpClass(cls):
     """Create an user and import different keys from data json file"""
     super(SshKeyInUserTestCase, cls).setUpClass()
     cls.user = entities.User().create()
     cls.data_keys = json.loads(read_data_file('sshkeys.json'))
Exemplo n.º 42
0
    def test_positive_consume_content_using_repo(self):
        """Hosts can install packages using gpg key associated with single
        custom repository

        :id: c6b78312-91d3-47a2-a6c6-f906a4522fe4

        :expectedresults: host can install package from custom repository

        :CaseLevel: System
        """
        key_name = gen_string('alphanumeric')
        # step1: Create gpg-key
        gpgkey = entities.GPGKey(
            content=read_data_file(ZOO_CUSTOM_GPG_KEY),
            name=key_name,
            organization=self.organization,
        ).create()
        # step 1.2: Create new lifecycle environments
        lc_env = entities.LifecycleEnvironment(
            organization=self.organization).create()
        # step2: Creates new product without selecting GPGkey
        product = entities.Product(
            name=gen_string('alpha'),
            organization=self.organization,
        ).create()
        # step3: Creates new repository with GPGKey
        repo = entities.Repository(
            name=gen_string('alpha'),
            url=FAKE_1_YUM_REPO,
            product=product,
            gpg_key=gpgkey,
        ).create()
        # step 3.1: sync repository
        repo.sync()
        # step 4: Create content view
        content_view = entities.ContentView(
            organization=self.organization).create()
        # step 5: Associate repository to new content view
        content_view.repository = [repo]
        content_view = content_view.update(['repository'])
        # step 6: Publish content view
        content_view.publish()
        content_view = content_view.read()
        self.assertEqual(len(content_view.version), 1)
        # step 6.2: Promote content view to lifecycle_env
        content_view.version[0].promote(data={u'environment_id': lc_env.id})
        # step 7: Create activation key
        act_key = entities.ActivationKey(
            content_view=content_view,
            environment=lc_env,
            name=gen_string('alpha'),
            organization=self.organization,
        ).create()
        for sub in entities.Subscription(
                organization=self.organization).search():
            if sub.read_json()['product_name'] == product.name:
                act_key.add_subscriptions(data={
                    'quantity': 1,
                    'subscription_id': sub.id,
                })
                break
        # Create VM
        package_name = 'cow'
        with VirtualMachine(distro=DISTRO_RHEL6) as vm:
            # Download and Install rpm
            result = vm.run(
                "wget -nd -r -l1 --no-parent -A '*-latest.noarch.rpm'"
                " http://{0}/pub/".format(settings.server.hostname))
            self.assertEqual(result.return_code, 0)
            result = vm.run('rpm -i katello-ca-consumer*.noarch.rpm')
            self.assertEqual(
                result.return_code, 0,
                'failed to install katello-ca rpm: {0} and return code: {1}'.
                format(result.stderr, result.return_code))
            # Register client with foreman server using activation-key
            result = vm.run(
                u'subscription-manager register --activationkey {0} '
                '--org {1} --force'.format(act_key.name,
                                           self.organization.label))
            # Commenting following lines because:
            # When we register a host without associating the installed OS
            # subscriptions, SM register command succeed with exit code '1'.
            # self.assertEqual(
            #    result.return_code, 0,
            #    "failed to register client:: {0} and return code: {1}"
            #    .format(result.stderr, result.return_code)
            # )

            # Validate if gpgcheck flag is enabled in repo file
            repo_file = '/etc/yum.repos.d/redhat.repo'
            result = vm.run(
                'cat {0} | grep gpgcheck | cut -d " " -f3'.format(repo_file))
            self.assertEqual(u'1', result.stdout[0])
            # Install contents from sat6 server
            result = vm.run('yum install -y {0}'.format(package_name))
            self.assertEqual(
                result.return_code, 0,
                'Package install failed: {0} and return code: {1}'.format(
                    result.stderr, result.return_code))
            # Verify if package is installed by query it
            result = vm.run('rpm -q {0}'.format(package_name))
            self.assertEqual(result.return_code, 0)
Exemplo n.º 43
0
 def setUpClass(cls):
     super(GPGKeyProductAssociateTestCase, cls).setUpClass()
     cls.key_content = read_data_file(VALID_GPG_KEY_FILE)
     cls.key_path = get_data_file(VALID_GPG_KEY_FILE)
     cls.organization = entities.Organization().create()
Exemplo n.º 44
0
 def setup_class(cls):
     cls.key_content = read_data_file(VALID_GPG_KEY_FILE)
     cls.key_path = get_data_file(VALID_GPG_KEY_FILE)
     cls.organization = entities.Organization().create()
Exemplo n.º 45
0
 def setUpClass(cls):
     """Create an organization which can be re-used in tests."""
     super(GPGKeyTestCase, cls).setUpClass()
     cls.org = entities.Organization().create()
     cls.key_content = read_data_file(VALID_GPG_KEY_FILE)
Exemplo n.º 46
0
def test_positive_end_to_end(session, module_org):
    """Perform end to end testing for product component

    :id: d0e1f0d1-2380-4508-b270-62c1d8b3e2ff

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: High
    """
    product_name = gen_string('alpha')
    new_product_name = gen_string('alpha')
    product_label = gen_string('alpha')
    product_description = gen_string('alpha')
    gpg_key = entities.GPGKey(
        content=read_data_file(VALID_GPG_KEY_FILE),
        organization=module_org
    ).create()
    sync_plan = entities.SyncPlan(organization=module_org).create()
    with session:
        # Create new product using different parameters
        session.product.create({
            'name': product_name,
            'label': product_label,
            'gpg_key': gpg_key.name,
            'sync_plan': sync_plan.name,
            'description': product_description,
        })
        assert session.product.search(product_name)[0]['Name'] == product_name
        # Verify that created entity has expected parameters
        product_values = session.product.read(product_name)
        assert product_values['details']['name'] == product_name
        assert product_values['details']['label'] == product_label
        assert product_values['details']['gpg_key'] == gpg_key.name
        assert product_values['details']['description'] == product_description
        assert product_values['details']['sync_plan'] == sync_plan.name
        # Update a product with a different name
        session.product.update(
            product_name, {'details.name': new_product_name}
        )
        assert not session.product.search(product_name)
        assert session.product.search(new_product_name)[0]['Name'] == new_product_name
        # Add a repo to product
        session.repository.create(
            new_product_name,
            {
                'name': gen_string('alpha'),
                'repo_type': REPO_TYPE['yum'],
                'repo_content.upstream_url': FAKE_1_YUM_REPO,
            }
        )
        # Synchronize the product
        result = session.product.synchronize(new_product_name)
        assert result['result'] == 'success'
        product_values = session.product.read(new_product_name)
        assert product_values['details']['repos_count'] == '1'
        assert product_values['details']['sync_state'] == 'Syncing Complete.'
        # Delete product
        session.product.delete(new_product_name)
        assert not session.product.search(new_product_name)
Exemplo n.º 47
0
def gpg_content():
    return read_data_file(VALID_GPG_KEY_FILE)
Exemplo n.º 48
0
 def setUpClass(cls):
     """Create an user and import different keys from data json file"""
     super(SshKeyInUserTestCase, cls).setUpClass()
     cls.user = entities.User().create()
     cls.data_keys = json.loads(read_data_file('sshkeys.json'))
Exemplo n.º 49
0
@TestType: Functional

@CaseImportance: High

@Upstream: No
"""
import json

from robottelo import ssh
from robottelo.cli import hammer
from robottelo.decorators import bz_bug_is_open, tier1
from robottelo.helpers import read_data_file
from robottelo.test import CLITestCase
from six import StringIO

HAMMER_COMMANDS = json.loads(read_data_file('hammer_commands.json'))


def _fetch_command_info(command):
    """Fetch command info from expected commands info dictionary."""
    info = HAMMER_COMMANDS
    if command != 'hammer':
        found = []
        parts = command.split(' ')[1:]  # exclude hammer
        for part in parts:
            for command in info['subcommands']:
                if command['name'] == part:
                    found.append(part)
                    info = command
                    break
        if found != parts:
Exemplo n.º 50
0
 def setUpClass(cls):
     super(GPGKey, cls).setUpClass()
     cls.key_content = read_data_file(VALID_GPG_KEY_FILE)
     cls.key_path = get_data_file(VALID_GPG_KEY_FILE)
     cls.organization = entities.Organization().create()
Exemplo n.º 51
0
    def test_positive_consume_content_using_repo(self):
        """Hosts can install packages using gpg key associated with
        single custom repository

        @id: c6b78312-91d3-47a2-a6c6-f906a4522fe4

        @assert: host can install package from custom repository

        @CaseLevel: System
        """
        key_name = gen_string("alphanumeric")
        # step1: Create gpg-key
        gpgkey = entities.GPGKey(
            content=read_data_file(ZOO_CUSTOM_GPG_KEY), name=key_name, organization=self.organization
        ).create()
        # step 1.2: Create new lifecycle environments
        lc_env = entities.LifecycleEnvironment(organization=self.organization).create()
        # step2: Creates new product without selecting GPGkey
        product = entities.Product(name=gen_string("alpha"), organization=self.organization).create()
        # step3: Creates new repository with GPGKey
        repo = entities.Repository(
            name=gen_string("alpha"), url=FAKE_1_YUM_REPO, product=product, gpg_key=gpgkey
        ).create()
        # step 3.1: sync repository
        repo.sync()
        # step 4: Create content view
        content_view = entities.ContentView(organization=self.organization).create()
        # step 5: Associate repository to new content view
        content_view.repository = [repo]
        content_view = content_view.update(["repository"])
        # step 6: Publish content view
        content_view.publish()
        content_view = content_view.read()
        self.assertEqual(len(content_view.version), 1)
        # step 6.2: Promote content view to lifecycle_env
        content_view.version[0].promote(data={u"environment_id": lc_env.id})
        # step 7: Create activation key
        act_key = entities.ActivationKey(
            content_view=content_view, environment=lc_env, name=gen_string("alpha"), organization=self.organization
        ).create()
        for sub in entities.Subscription(organization=self.organization).search():
            if sub.read_json()["product_name"] == product.name:
                act_key.add_subscriptions(data={"quantity": 1, "subscription_id": sub.id})
                break
        # Create VM
        package_name = "cow"
        with VirtualMachine(distro=DISTRO_RHEL6) as vm:
            # Download and Install rpm
            result = vm.run(
                "wget -nd -r -l1 --no-parent -A '*.noarch.rpm' http://{0}/pub/".format(settings.server.hostname)
            )
            self.assertEqual(result.return_code, 0)
            result = vm.run("rpm -i katello-ca-consumer*.noarch.rpm")
            self.assertEqual(
                result.return_code,
                0,
                "failed to install katello-ca rpm: {0} and return code: {1}".format(result.stderr, result.return_code),
            )
            # Register client with foreman server using activation-key
            result = vm.run(
                u"subscription-manager register --activationkey {0} "
                "--org {1} --force".format(act_key.name, self.organization.label)
            )
            # Commenting following lines because:
            # When we register a host without associating the installed OS
            # subscriptions, SM register command succeed with exit code '1'.
            # self.assertEqual(
            #    result.return_code, 0,
            #    "failed to register client:: {0} and return code: {1}"
            #    .format(result.stderr, result.return_code)
            # )

            # Validate if gpgcheck flag is enabled in repo file
            repo_file = "/etc/yum.repos.d/redhat.repo"
            result = vm.run('cat {0} | grep gpgcheck | cut -d " " -f3'.format(repo_file))
            self.assertEqual(u"1", result.stdout[0])
            # Install contents from sat6 server
            result = vm.run("yum install -y {0}".format(package_name))
            self.assertEqual(
                result.return_code,
                0,
                "Package install failed: {0} and return code: {1}".format(result.stderr, result.return_code),
            )
            # Verify if package is installed by query it
            result = vm.run("rpm -q {0}".format(package_name))
            self.assertEqual(result.return_code, 0)
Exemplo n.º 52
0
def template_data():
    return read_data_file(PARTITION_SCRIPT_DATA_FILE)
Exemplo n.º 53
0
"""Tests related to hammer command and its options and subcommands."""
import json

from robottelo import ssh
from robottelo.cli import hammer
from robottelo.decorators import bz_bug_is_open, tier1
from robottelo.helpers import read_data_file
from robottelo.test import CLITestCase

HAMMER_COMMANDS = json.loads(read_data_file('hammer_commands.json'))


def _fetch_command_info(command):
    """Fetch command info from expected commands info dictionary."""
    info = HAMMER_COMMANDS
    if command != 'hammer':
        found = []
        parts = command.split(' ')[1:]  # exclude hammer
        for part in parts:
            for command in info['subcommands']:
                if command['name'] == part:
                    found.append(part)
                    info = command
                    break
        if found != parts:
            return None
        return info


class HammerCommandsTestCase(CLITestCase):
    """Tests for ensuring that  all expected hammer subcommands and its options
Exemplo n.º 54
0
 def create_user(self):
     """Create an user and import different keys from data json file"""
     user = entities.User().create()
     data_keys = json.loads(read_data_file('sshkeys.json'))
     return dict(user=user, data_keys=data_keys)
Exemplo n.º 55
0
:Upstream: No
"""
import pytest
from fauxfactory import gen_string
from nailgun import entities
from requests import HTTPError

from robottelo.constants import VALID_GPG_KEY_BETA_FILE
from robottelo.constants import VALID_GPG_KEY_FILE
from robottelo.datafactory import invalid_values_list
from robottelo.datafactory import parametrized
from robottelo.datafactory import valid_data_list
from robottelo.helpers import read_data_file

key_content = read_data_file(VALID_GPG_KEY_FILE)


@pytest.mark.parametrize('name', **parametrized(valid_data_list()))
@pytest.mark.tier1
def test_positive_create_with_name(module_org, name):
    """Create a GPG key with valid name.

    :id: 741d969b-28ef-481f-bcf7-ed4cd920b030

    :parametrized: yes

    :expectedresults: A GPG key is created with the given name.

    :CaseImportance: Critical
    """
Exemplo n.º 56
0
def template_data():
    return read_data_file(OS_TEMPLATE_DATA_FILE)
Exemplo n.º 57
0
 def setUpClass(cls):
     """Create an organization which can be re-used in tests."""
     super(GPGKeyTestCase, cls).setUpClass()
     cls.org = entities.Organization().create()
     cls.key_content = read_data_file(VALID_GPG_KEY_FILE)