本文整理汇总了Python中cfme.automate.explorer.domain.DomainCollection类的典型用法代码示例。如果您正苦于以下问题:Python DomainCollection类的具体用法?Python DomainCollection怎么用?Python DomainCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DomainCollection类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: domain
def domain(appliance):
dc = DomainCollection(appliance)
d = dc.create(
name='test_{}'.format(fauxfactory.gen_alpha()),
description='desc_{}'.format(fauxfactory.gen_alpha()),
enabled=True)
yield d
d.delete()
示例2: test_domain_cannot_edit_builtin
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
示例3: copy_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
示例4: qe_ae_data
def qe_ae_data(request, ssh_client, rake):
ssh_client.put_file(cli_path.join("QECliTesting.yaml").strpath, "/root/QECliTesting.yaml")
rc, stdout = rake(
"evm:automate:import DOMAIN=QECliTesting YAML_FILE=/root/QECliTesting.yaml PREVIEW=false "
"ENABLED=true SYSTEM=false")
assert rc == 0, stdout
# Now we have to enable the domain to make it work.
qe_cli_testing = DomainCollection().instantiate(name='QECliTesting')
request.addfinalizer(qe_cli_testing.delete_if_exists)
if not qe_cli_testing.enabled:
with update(qe_cli_testing):
qe_cli_testing.enabled = True
示例5: test_duplicate_domain_disallowed
def test_duplicate_domain_disallowed(request):
domains = DomainCollection()
domain = domains.create(
name=fauxfactory.gen_alpha(),
description=fauxfactory.gen_alpha(),
enabled=True)
request.addfinalizer(domain.delete_if_exists)
with error.expected("Name has already been taken"):
domains.create(
name=domain.name,
description=domain.description,
enabled=domain.enabled)
示例6: test_domain_lock_unlock
def test_domain_lock_unlock(request):
domains = DomainCollection()
domain = domains.create(
name=fauxfactory.gen_alpha(),
description=fauxfactory.gen_alpha(),
enabled=True)
request.addfinalizer(domain.delete)
ns1 = domain.namespaces.create(name='ns1')
ns2 = ns1.namespaces.create(name='ns2')
cls = ns2.classes.create(name='class1')
cls.schema.add_field(name='myfield', type='Relationship')
inst = cls.instances.create(name='inst')
meth = cls.methods.create(name='meth', script='$evm')
# Lock the domain
domain.lock()
# Check that nothing is editable
# namespaces
details = navigate_to(ns1, 'Details')
assert not details.configuration.is_displayed
details = navigate_to(ns2, 'Details')
assert not details.configuration.is_displayed
# class
details = navigate_to(cls, 'Details')
assert details.configuration.items == ['Copy selected Instances']
assert not details.configuration.item_enabled('Copy selected Instances')
details.schema.select()
assert not details.configuration.is_displayed
# instance
details = navigate_to(inst, 'Details')
assert details.configuration.items == ['Copy this Instance']
# method
details = navigate_to(meth, 'Details')
assert details.configuration.items == ['Copy this Method']
# Unlock it
domain.unlock()
# Check that it is editable
with update(ns1):
ns1.name = 'UpdatedNs1'
assert ns1.exists
with update(ns2):
ns2.name = 'UpdatedNs2'
assert ns2.exists
with update(cls):
cls.name = 'UpdatedClass'
assert cls.exists
cls.schema.add_field(name='myfield2', type='Relationship')
with update(inst):
inst.name = 'UpdatedInstance'
assert inst.exists
with update(meth):
meth.name = 'UpdatedMethod'
assert meth.exists
示例7: create_domain
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
示例8: import_domain_from
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!')
示例9: test_domain_delete_from_table
def test_domain_delete_from_table(request):
domains = DomainCollection()
generated = []
for _ in range(3):
domain = domains.create(
name=fauxfactory.gen_alpha(),
description=fauxfactory.gen_alpha(),
enabled=True)
request.addfinalizer(domain.delete_if_exists)
generated.append(domain)
domains.delete(*generated)
for domain in generated:
assert not domain.exists
示例10: test_domain_present
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))
示例11: test_domain_crud
def test_domain_crud(request, enabled):
domains = DomainCollection()
domain = domains.create(
name=fauxfactory.gen_alpha(),
description=fauxfactory.gen_alpha(),
enabled=enabled)
request.addfinalizer(domain.delete_if_exists)
assert domain.exists
# TODO: Verify details
updated_description = "editdescription{}".format(fauxfactory.gen_alpha())
with update(domain):
domain.description = updated_description
assert domain.exists
domain.delete(cancel=True)
assert domain.exists
domain.delete()
assert not domain.exists
示例12: test_domain_crud
def test_domain_crud(request, enabled):
domains = DomainCollection()
domain = domains.create(
name=fauxfactory.gen_alpha(),
description=fauxfactory.gen_alpha(),
enabled=enabled)
request.addfinalizer(domain.delete_if_exists)
assert domain.exists
view = navigate_to(domain, 'Details')
if enabled:
assert 'Disabled' not in view.title.text
else:
assert 'Disabled' in view.title.text
updated_description = "editdescription{}".format(fauxfactory.gen_alpha())
with update(domain):
domain.description = updated_description
view = navigate_to(domain, 'Edit')
assert view.description.value == updated_description
assert domain.exists
domain.delete(cancel=True)
assert domain.exists
domain.delete()
assert not domain.exists
示例13: test_domain_present
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))
示例14: test_domain_name_wrong
def test_domain_name_wrong():
domains = DomainCollection()
with error.expected('Name may contain only'):
domains.create(name='with space')