本文整理汇总了Python中cfme.configure.access_control.User.full_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.full_name方法的具体用法?Python User.full_name怎么用?Python User.full_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfme.configure.access_control.User
的用法示例。
在下文中一共展示了User.full_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: login
# 需要导入模块: from cfme.configure.access_control import User [as 别名]
# 或者: from cfme.configure.access_control.User import full_name [as 别名]
def login(user, submit_method=_js_auth_fn):
"""
Login to CFME with the given username and password.
Optionally, submit_method can be press_enter_after_password
to use the enter key to login, rather than clicking the button.
Args:
user: The username to fill in the username field.
password: The password to fill in the password field.
submit_method: A function to call after the username and password have been input.
Raises:
RuntimeError: If the login fails, ie. if a flash message appears
"""
if not user:
username = conf.credentials['default']['username']
password = conf.credentials['default']['password']
cred = Credential(principal=username, secret=password)
user = User(credential=cred)
if not logged_in() or user.credential.principal is not current_username():
if logged_in():
logout()
# workaround for strange bug where we are logged out
# as soon as we click something on the dashboard
sel.sleep(1.0)
logger.debug('Logging in as user %s', user.credential.principal)
try:
fill(form, {'username': user.credential.principal, 'password': user.credential.secret})
except sel.InvalidElementStateException as e:
logger.warning("Got an error. Details follow.")
msg = str(e).lower()
if "element is read-only" in msg:
logger.warning("Got a read-only login form, will reload the browser.")
# Reload browser
quit()
ensure_browser_open()
sel.sleep(1.0)
sel.wait_for_ajax()
# And try filling the form again
fill(form, {'username': user.credential.principal,
'password': user.credential.secret})
else:
logger.warning("Unknown error, reraising.")
logger.exception(e)
raise
with sel.ajax_timeout(90):
submit_method()
flash.assert_no_errors()
user.full_name = _full_name()
store.user = user