本文整理汇总了Python中utils.conf.cfme_data.get函数的典型用法代码示例。如果您正苦于以下问题:Python get函数的具体用法?Python get怎么用?Python get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: from_config
def from_config(cls):
url = cfme_data.get("bugzilla", {}).get("url", None)
product = cfme_data.get("bugzilla", {}).get("product", None)
if url is None:
raise Exception("No Bugzilla URL specified!")
cr_root = cfme_data.get("bugzilla", {}).get("credentials", None)
username = credentials.get(cr_root, {}).get("username", None)
password = credentials.get(cr_root, {}).get("password", None)
return cls(
url=url, user=username, password=password, cookiefile=None,
tokenfile=None, product=product)
开发者ID:amavinag,项目名称:cfme_tests,代码行数:11,代码来源:bz.py
示例2: _skip_test_flags
def _skip_test_flags(data, metafunc, required_fields):
# Test to see the test has meta data, if it does and that metadata contains
# a test_flag kwarg, then check to make sure the provider contains that test_flag
# if not, do not collect the provider for this particular test.
# Obtain the tests flags
meta = getattr(metafunc.function, 'meta', None)
test_flags = getattr(meta, 'kwargs', {}) \
.get('from_docs', {}).get('test_flag', '').split(',')
if test_flags != ['']:
test_flags = [flag.strip() for flag in test_flags]
defined_flags = cfme_data.get('test_flags', '').split(',')
defined_flags = [flag.strip() for flag in defined_flags]
excluded_flags = data.get('excluded_test_flags', '').split(',')
excluded_flags = [flag.strip() for flag in excluded_flags]
allowed_flags = set(defined_flags) - set(excluded_flags)
if set(test_flags) - allowed_flags:
logger.info("Skipping Provider %s for test %s in module %s because "
"it does not have the right flags, "
"%s does not contain %s",
data['name'], metafunc.function.func_name, metafunc.function.__module__,
list(allowed_flags), list(set(test_flags) - allowed_flags))
return True
return False
开发者ID:vnugent,项目名称:cfme_tests,代码行数:28,代码来源:testgen.py
示例3: _uncollect_test_flags
def _uncollect_test_flags(data, metafunc, required_fields):
# Test to see the test has meta data, if it does and that metadata contains
# a test_flag kwarg, then check to make sure the provider contains that test_flag
# if not, do not collect the provider for this particular test.
# Obtain the tests flags
meta = getattr(metafunc.function, "meta", None)
test_flags = getattr(meta, "kwargs", {}).get("from_docs", {}).get("test_flag", "").split(",")
if test_flags != [""]:
test_flags = [flag.strip() for flag in test_flags]
defined_flags = cfme_data.get("test_flags", "").split(",")
defined_flags = [flag.strip() for flag in defined_flags]
excluded_flags = data.get("excluded_test_flags", "").split(",")
excluded_flags = [flag.strip() for flag in excluded_flags]
allowed_flags = set(defined_flags) - set(excluded_flags)
if set(test_flags) - allowed_flags:
logger.info(
"Uncollecting Provider %s for test %s in module %s because "
"it does not have the right flags, "
"%s does not contain %s",
data["name"],
metafunc.function.func_name,
metafunc.function.__module__,
list(allowed_flags),
list(set(test_flags) - allowed_flags),
)
return True
return False
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:32,代码来源:testgen.py
示例4: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.infra_providers(metafunc, 'provisioning')
argnames = argnames + ['cloud_init_template']
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if not args['provisioning']:
# No provisioning data available
continue
if args['provider_type'] == "scvmm" or args['provider_type'] == 'virtualcenter':
continue
# required keys should be a subset of the dict keys set
if not {'ci-template', 'ci-username', 'ci-pass', 'template'}.issubset(
args['provisioning'].viewkeys()):
continue
cloud_init_template = args['provisioning']['ci-template']
if cloud_init_template not in cfme_data.get('customization_templates', {}).keys():
continue
argvalues[i].append(get_template_from_config(cloud_init_template))
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:31,代码来源:test_cloud_init_provisioning.py
示例5: direct_connection
def direct_connection(self):
"""Returns an API from mgmt_system.py targeted at this provider"""
# Find the credentials entry
name = str(self.host_name)
from utils.conf import cfme_data, credentials
for prov_id, provider in cfme_data.get("management_systems", {}).iteritems():
if provider.get("hostname", None) == name or provider.get("region", None) == name:
credentials = credentials.get(provider["credentials"], {})
provider_id = prov_id
break
else:
raise NameError("Could not find provider %s in the credentials!" % name)
ptype = str(self.type).lower()
if ptype == "emsredhat":
from utils.mgmt_system import RHEVMSystem
return RHEVMSystem(self.host_name, credentials["username"], credentials["password"])
elif ptype == "emsvmware":
from utils.mgmt_system import VMWareSystem
return VMWareSystem(self.host_name, credentials["username"], credentials["password"])
elif ptype == "emsamazon":
from utils.mgmt_system import EC2System
return EC2System(**credentials)
elif ptype == "emsopenstack":
from utils.mgmt_system import OpenstackSystem
credentials.update(
{"auth_url": cfme_data["management_systems"][provider_id]["auth_url"]}
)
return OpenstackSystem(**credentials)
else:
TypeError("Unknown Provider type!")
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:30,代码来源:miq_soap.py
示例6: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.infra_providers(metafunc, required_fields=[
'iso_datastore',
['provisioning', 'host'],
['provisioning', 'datastore'],
['provisioning', 'iso_template'],
['provisioning', 'iso_file'],
['provisioning', 'iso_kickstart'],
['provisioning', 'iso_root_password'],
['provisioning', 'iso_image_type'],
['provisioning', 'vlan'],
])
argnames = argnames + ['iso_cust_template', 'iso_datastore']
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
iso_cust_template = args['provider'].data['provisioning']['iso_kickstart']
if iso_cust_template not in cfme_data.get('customization_templates', {}).keys():
continue
argvalues[i].append(get_template_from_config(iso_cust_template))
argvalues[i].append(ISODatastore(args['provider'].name))
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:akrzos,项目名称:cfme_tests,代码行数:30,代码来源:test_iso_service_catalogs.py
示例7: bug
def bug(request):
"""Fixture, that when called provides specific bug. No machinery that changes the ID is involved
Usage:
.. code-block:: python
@pytest.mark.bugzilla(1234)
# or just @pytest.mark.bugzilla if you want no generic skipping and so
def test_something(bug):
if bug(345).status is "blabla":
foo()
bar()
baz()
It works only on ``bugzilla``-marked tests so far. After I find some neat 'global' store in
py.test, I will modify it to be usable everywhere.
If bugzilla integration is disabled, it returns BugMock instance which answers False on each
comparison, equality or attribute.
"""
try:
return lambda bug_id: getbug_cached(
request.node._bugzilla, bug_id, cfme_data.get("bugzilla", {}).get("loose", []))
except AttributeError:
return lambda *args, **kwargs: BugMock()
开发者ID:jkrocil,项目名称:cfme_tests,代码行数:25,代码来源:bz.py
示例8: auth_groups
def auth_groups(metafunc, auth_mode):
"""Provides two test params based on the 'auth_modes' and 'group_roles' in cfme_data:
``group_name``:
expected group name in provided by the backend specified in ``auth_mode``
``group_data``:
list of nav destinations that should be visible as a member of ``group_name``
Args:
auth_mode: One of the auth_modes specified in ``cfme_data.get('auth_modes', {})``
"""
argnames = ['group_name', 'group_data']
argvalues = []
idlist = []
if auth_mode in cfme_data.get('auth_modes', {}):
# If auth_modes exists, group_roles is assumed to exist as well
gdata = group_data()
for group in gdata:
argvalues.append([group, sorted(gdata[group])])
idlist.append(group)
return argnames, argvalues, idlist
开发者ID:prachiyadav,项目名称:cfme_tests,代码行数:25,代码来源:testgen.py
示例9: exists
def exists(self):
sel.force_navigate('clouds_tenants')
provider_name = cfme_data.get('management_systems', {})[self.provider_key]['name']
res = list_page.tenant_table.find_row_by_cells({'Name': self.name,
'Cloud Provider': provider_name})
if res:
return True
else:
return False
开发者ID:FilipB,项目名称:cfme_tests,代码行数:9,代码来源:tenant.py
示例10: pytest_generate_tests
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = ['db_url', 'db_version', 'db_desc'], [], []
db_backups = cfme_data.get('db_backups', {})
if not db_backups:
return []
for key, data in db_backups.iteritems():
argvalues.append((data.url, data.version, data.desc))
idlist.append(key)
return metafunc.parametrize(argnames=argnames, argvalues=argvalues, ids=idlist)
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:9,代码来源:test_db_migrate.py
示例11: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.infra_providers(metafunc, "provisioning")
argnames = argnames + ["iso_cust_template", "iso_datastore"]
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if not args["provisioning"]:
# No provisioning data available
continue
if args["provider_type"] == "scvmm":
continue
provider_data = cfme_data.get("management_systems", {})[argvalue_tuple[argnames.index("provider_key")]]
if not provider_data.get("iso_datastore", False):
continue
# required keys should be a subset of the dict keys set
if not {
"iso_template",
"host",
"datastore",
"iso_file",
"iso_kickstart",
"iso_root_password",
"iso_image_type",
"vlan",
}.issubset(args["provisioning"].viewkeys()):
# Need all for template provisioning
continue
iso_cust_template = args["provisioning"]["iso_kickstart"]
if iso_cust_template not in cfme_data.get("customization_templates", {}).keys():
continue
argvalues[i].append(get_template_from_config(iso_cust_template))
argvalues[i].append(ISODatastore(provider_data["name"]))
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:seandst,项目名称:cfme_tests,代码行数:44,代码来源:test_iso_provisioning.py
示例12: group
def group():
data = cfme_data.get("openldap_test", {})
if not data:
pytest.skip("No openldap_test section in yaml")
credentials = Credential(
principal=data["username"],
secret=data["password"],
)
return Group(description=data["group_name"], role="EvmRole-user",
user_to_lookup=data['username'], ldap_credentials=credentials)
开发者ID:FilipB,项目名称:cfme_tests,代码行数:10,代码来源:test_openldap_auth.py
示例13: configure_openldap_auth_mode
def configure_openldap_auth_mode(browser, available_auth_modes):
"""Configure LDAP authentication mode"""
if 'miq_openldap' in available_auth_modes:
server_data = cfme_data.get('auth_modes', {})['miq_openldap']
configuration.set_auth_mode(**server_data)
yield
current_appliance.server.login_admin()
configuration.set_auth_mode(mode='database')
else:
yield
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:10,代码来源:configure_auth_mode.py
示例14: group_data
def group_data():
roles = cfme_data.get("group_roles", {})
# These roles are not present on 5.2 appliance in these groups
if version.current_version() < "5.3":
_remove_page(roles, "evmgroup-super_administrator", ["clouds_tenants"])
_remove_page(roles, "evmgroup-user", ["services_requests", "infrastructure_requests"])
if version.current_version() < "5.4":
_remove_from_all(roles, "clouds_stacks")
_remove_from_all(roles, "infrastructure_config_management")
return roles
开发者ID:pombredanne,项目名称:cfme_tests,代码行数:11,代码来源:roles.py
示例15: objects_from_config
def objects_from_config(*keys):
result = {}
for key, data in cfme_data.get("storage", {}).get("managers", {}).iteritems():
if keys and key not in keys:
continue
data = copy(data)
if "credentials" in data:
data["credentials"] = StorageManager.Credential(
**credentials.get(data["credentials"], {}))
result[key] = StorageManager(**data)
return result
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:11,代码来源:storage_managers.py
示例16: configure_openldap_auth_mode_default_groups
def configure_openldap_auth_mode_default_groups(browser, available_auth_modes):
"""Configure LDAP authentication mode"""
if 'miq_openldap' in available_auth_modes:
server_data = cfme_data.get('auth_modes', {})['miq_openldap']
server_data['get_groups'] = False
server_data['default_groups'] = 'EvmRole-user'
configuration.set_auth_mode(**server_data)
yield
current_appliance.server.login_admin()
configuration.set_auth_mode(mode='database')
else:
yield
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:12,代码来源:configure_auth_mode.py
示例17: pytest_configure
def pytest_configure(config):
path = cfme_data.get("cfme_annotations_path")
if path:
to_parse = project_path.join(path)
parsed = parse(to_parse)
if not parsed:
store.terminalreporter.line("no test annotation found in {}".format(to_parse), yellow=True)
else:
store.terminalreporter.line("no test annotation found in {}".format(path), yellow=True)
parsed = []
config.pluginmanager.register(MarkFromMap.from_parsed_list(parsed, "tier", pytest.mark.tier))
config.pluginmanager.register(MarkFromMap.from_parsed_list(parsed, "requirement", pytest.mark.requirement))
config.pluginmanager.register(MarkFromMap.from_parsed_list(parsed, "type", pytest.mark.__getattr__))
开发者ID:anewmanRH,项目名称:cfme_tests,代码行数:13,代码来源:node_annotate.py
示例18: pytest_generate_tests
def pytest_generate_tests(metafunc):
# Filter out providers without provisioning data or hosts defined
argnames, argvalues, idlist = testgen.infra_providers(metafunc, 'provisioning')
argnames = argnames + ['iso_cust_template', 'iso_datastore']
new_idlist = []
new_argvalues = []
for i, argvalue_tuple in enumerate(argvalues):
args = dict(zip(argnames, argvalue_tuple))
if not args['provisioning']:
# No provisioning data available
continue
if args['provider_type'] == "scvmm":
continue
provider_data = cfme_data.get('management_systems', {})[
argvalue_tuple[argnames.index('provider_key')]]
if not provider_data.get('iso_datastore', False):
continue
# required keys should be a subset of the dict keys set
if not {'iso_template', 'host', 'datastore',
'iso_file', 'iso_kickstart',
'iso_root_password',
'iso_image_type', 'vlan'}.issubset(args['provisioning'].viewkeys()):
# Need all for template provisioning
continue
iso_cust_template = args['provisioning']['iso_kickstart']
if iso_cust_template not in cfme_data.get('customization_templates', {}).keys():
continue
argvalues[i].append(get_template_from_config(iso_cust_template))
argvalues[i].append(ISODatastore(provider_data['name']))
new_idlist.append(idlist[i])
new_argvalues.append(argvalues[i])
testgen.parametrize(metafunc, argnames, new_argvalues, ids=new_idlist, scope="module")
开发者ID:petrblaho,项目名称:cfme_tests,代码行数:39,代码来源:test_iso_provisioning.py
示例19: configure_aws_iam_auth_mode
def configure_aws_iam_auth_mode(browser, available_auth_modes):
"""Configure AWS IAM authentication mode"""
if 'miq_aws_iam' in available_auth_modes:
aws_iam_data = dict(cfme_data.get('auth_modes', {})['miq_aws_iam'])
aws_iam_creds = credentials[aws_iam_data.pop('credentials')]
aws_iam_data['access_key'] = aws_iam_creds['username']
aws_iam_data['secret_key'] = aws_iam_creds['password']
configuration.set_auth_mode(**aws_iam_data)
yield
current_appliance.server.login_admin()
configuration.set_auth_mode(mode='database')
else:
yield
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:13,代码来源:configure_auth_mode.py
示例20: config_managers
def config_managers(metafunc):
"""Provides config managers
"""
argnames = ["config_manager_obj"]
argvalues = []
idlist = []
data = cfme_data.get("configuration_managers", {})
for cfg_mgr_key in data:
argvalues.append([get_config_manager_from_config(cfg_mgr_key)])
idlist.append(cfg_mgr_key)
return argnames, argvalues, idlist
开发者ID:ManageIQ,项目名称:integration_tests,代码行数:13,代码来源:testgen.py
注:本文中的utils.conf.cfme_data.get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论