def copy_domain(request, appliance):
    dc = DomainCollection(appliance)
    domain = dc.create(name=fauxfactory.gen_alphanumeric(), enabled=True)
    request.addfinalizer(domain.delete_if_exists)
    dc.instantiate(name='ManageIQ')\
        .namespaces.instantiate(name='System')\
        .classes.instantiate(name='Request')\
        .copy_to(domain)
    return domain
def copy_domain(request, appliance):
    dc = DomainCollection(appliance)
    domain = dc.create(name=fauxfactory.gen_alphanumeric(), enabled=True)
    request.addfinalizer(domain.delete_if_exists)
    dc.instantiate(name='ManageIQ')\
        .namespaces.instantiate(name='System')\
        .classes.instantiate(name='Request')\
        .copy_to(domain)
    return domain
Exemplo n.º 3
0
def test_domain_cannot_edit_builtin():
    domains = DomainCollection()
    manageiq_domain = domains.instantiate(name='ManageIQ')
    details_view = navigate_to(manageiq_domain, 'Details')
    if domains.appliance.version < '5.7':
        assert details_view.configuration.is_displayed
        assert not details_view.configuration.item_enabled('Edit this Domain')
    else:
        assert not details_view.configuration.is_displayed
Exemplo n.º 4
0
def test_domain_cannot_delete_builtin(appliance):
    domains = DomainCollection(appliance)
    manageiq_domain = domains.instantiate(name='ManageIQ')
    details_view = navigate_to(manageiq_domain, 'Details')
    if domains.appliance.version < '5.7':
        assert details_view.configuration.is_displayed
        assert 'Remove this Domain' not in details_view.configuration.items
    else:
        assert not details_view.configuration.is_displayed
Exemplo n.º 5
0
def test_domain_cannot_edit_builtin():
    domains = DomainCollection()
    manageiq_domain = domains.instantiate(name='ManageIQ')
    details_view = navigate_to(manageiq_domain, 'Details')
    if domains.appliance.version < '5.7':
        assert details_view.configuration.is_displayed
        assert not details_view.configuration.item_enabled('Edit this Domain')
    else:
        assert not details_view.configuration.is_displayed
Exemplo n.º 6
0
    def import_domain_from(self, branch=None, tag=None):
        """Import the domain from git using the Import/Export UI.

        Args:
            branch: If you import from a branch, specify the origin/branchname
            tag: If you import from a tag, specify its name.

        Returns:
            Instance of :py:class:`cfme.automate.explorer.domain.Domain`

        **Important!** ``branch`` and ``tag`` are mutually exclusive.
        """
        imex_page = navigate_to(self.appliance.server, 'AutomateImportExport')
        assert imex_page.import_git.fill(self.fill_values_repo_add)
        imex_page.import_git.submit.click()
        imex_page.browser.plugin.ensure_page_safe(timeout='5m')
        git_select = self.create_view(GitImportSelectorView)
        assert git_select.is_displayed
        git_select.flash.assert_no_error()
        assert git_select.fill(self.fill_values_branch_select(branch, tag))
        git_select.submit.click()
        git_select.browser.plugin.ensure_page_safe(timeout='5m')
        imex_page = self.create_view(AutomateImportExportView)
        assert imex_page.is_displayed
        imex_page.flash.assert_no_error()
        # Now find the domain in database
        namespaces = self.appliance.db.client['miq_ae_namespaces']
        git_repositories = self.appliance.db.client['git_repositories']
        none = None
        query = self.appliance.db.client.session\
            .query(
                namespaces.id, namespaces.name, namespaces.description, git_repositories.url,
                namespaces.ref_type, namespaces.ref)\
            .filter(namespaces.parent_id == none, namespaces.source == 'remote')\
            .join(git_repositories, namespaces.git_repository_id == git_repositories.id)
        for id, name, description, url, git_type, git_type_value in query:
            if url != self.url:
                continue
            if not (git_type == 'branch' and branch == git_type_value
                    or git_type == 'tag' and tag == git_type_value):
                continue
            # We have the domain
            from cfme.automate.explorer.domain import DomainCollection
            dc = DomainCollection(appliance=self.appliance)
            return dc.instantiate(db_id=id,
                                  name=name,
                                  description=description,
                                  git_checkout_type=git_type,
                                  git_checkout_value=git_type_value)
        else:
            raise ValueError(
                'The domain imported was not found in the database!')
Exemplo n.º 7
0
def create_domain(request, appliance):
    """Create new domain and copy instance from ManageIQ to this domain"""

    dc = DomainCollection(appliance)
    new_domain = dc.create(name=fauxfactory.gen_alphanumeric(), enabled=True)
    request.addfinalizer(new_domain.delete_if_exists)
    instance = (dc.instantiate(name='ManageIQ')
        .namespaces.instantiate(name='Service')
        .namespaces.instantiate(name='Provisioning')
        .namespaces.instantiate(name='StateMachines')
        .classes.instantiate(name='ServiceProvisionRequestApproval')
        .instances.instantiate(name='Default'))
    instance.copy_to(new_domain)
    return new_domain
Exemplo n.º 8
0
    def import_domain_from(self, branch=None, tag=None):
        """Import the domain from git using the Import/Export UI.

        Args:
            branch: If you import from a branch, specify the origin/branchname
            tag: If you import from a tag, specify its name.

        Returns:
            Instance of :py:class:`cfme.automate.explorer.domain.Domain`

        **Important!** ``branch`` and ``tag`` are mutually exclusive.
        """
        imex_page = navigate_to(self.appliance.server, 'AutomateImportExport')
        assert imex_page.import_git.fill(self.fill_values_repo_add)
        imex_page.import_git.submit.click()
        imex_page.browser.plugin.ensure_page_safe(timeout='5m')
        git_select = self.create_view(GitImportSelectorView)
        assert git_select.is_displayed
        git_select.flash.assert_no_error()
        assert git_select.fill(self.fill_values_branch_select(branch, tag))
        git_select.submit.click()
        git_select.browser.plugin.ensure_page_safe(timeout='5m')
        imex_page = self.create_view(AutomateImportExportView)
        assert imex_page.is_displayed
        imex_page.flash.assert_no_error()
        # Now find the domain in database
        namespaces = self.appliance.db.client['miq_ae_namespaces']
        git_repositories = self.appliance.db.client['git_repositories']
        none = None
        query = self.appliance.db.client.session\
            .query(
                namespaces.id, namespaces.name, namespaces.description, git_repositories.url,
                namespaces.ref_type, namespaces.ref)\
            .filter(namespaces.parent_id == none, namespaces.source == 'remote')\
            .join(git_repositories, namespaces.git_repository_id == git_repositories.id)
        for id, name, description, url, git_type, git_type_value in query:
            if url != self.url:
                continue
            if not (
                    git_type == 'branch' and branch == git_type_value or
                    git_type == 'tag' and tag == git_type_value):
                continue
            # We have the domain
            from cfme.automate.explorer.domain import DomainCollection
            dc = DomainCollection(appliance=self.appliance)
            return dc.instantiate(
                db_id=id, name=name, description=description, git_checkout_type=git_type,
                git_checkout_value=git_type_value)
        else:
            raise ValueError('The domain imported was not found in the database!')
Exemplo n.º 9
0
def test_domain_present(domain_name, soft_assert, appliance):
    """This test verifies presence of domains that are included in the appliance.

    Prerequisities:
        * Clean appliance.

    Steps:
        * Open the Automate Explorer.
        * Verify that all of the required domains are present.
    """
    dc = DomainCollection()
    domain = dc.instantiate(name=domain_name)
    soft_assert(domain.exists, "Domain {} does not exist!".format(domain_name))
    soft_assert(domain.locked, "Domain {} is not locked!".format(domain_name))
    soft_assert(appliance.check_domain_enabled(domain_name),
                "Domain {} is not enabled!".format(domain_name))
Exemplo n.º 10
0
def test_domain_present(domain_name, soft_assert):
    """This test verifies presence of domains that are included in the appliance.

    Prerequisities:
        * Clean appliance.

    Steps:
        * Open the Automate Explorer.
        * Verify that all of the required domains are present.
    """
    dc = DomainCollection()
    domain = dc.instantiate(name=domain_name)
    soft_assert(domain.exists, "Domain {} does not exist!".format(domain_name))
    soft_assert(domain.locked, "Domain {} is not locked!".format(domain_name))
    soft_assert(
        dbq.check_domain_enabled(domain_name), "Domain {} is not enabled!".format(domain_name))
Exemplo n.º 11
0
def test_domain_present(domain_name, soft_assert, appliance):
    """This test verifies presence of domains that are included in the appliance.

    Prerequisities:
        * Clean appliance.

    Steps:
        * Open the Automate Explorer.
        * Verify that all of the required domains are present.

    Polarion:
        assignee: dmisharo
        casecomponent: Automate
        caseimportance: critical
        initialEstimate: 1/60h
        testtype: functional
    """
    dc = DomainCollection(appliance)
    domain = dc.instantiate(name=domain_name)
    soft_assert(domain.exists, "Domain {} does not exist!".format(domain_name))
    soft_assert(domain.locked, "Domain {} is not locked!".format(domain_name))
    soft_assert(
        appliance.check_domain_enabled(
            domain_name), "Domain {} is not enabled!".format(domain_name))
Exemplo n.º 12
0
def test_domain_present(domain_name, soft_assert, appliance):
    """This test verifies presence of domains that are included in the appliance.

    Prerequisities:
        * Clean appliance.

    Steps:
        * Open the Automate Explorer.
        * Verify that all of the required domains are present.

    Polarion:
        assignee: dmisharo
        casecomponent: automate
        caseimportance: critical
        initialEstimate: 1/60h
        testtype: functional
    """
    dc = DomainCollection(appliance)
    domain = dc.instantiate(name=domain_name)
    soft_assert(domain.exists, "Domain {} does not exist!".format(domain_name))
    soft_assert(domain.locked, "Domain {} is not locked!".format(domain_name))
    soft_assert(
        appliance.check_domain_enabled(
            domain_name), "Domain {} is not enabled!".format(domain_name))