本文整理匯總了Python中cfme.configure.access_control.User.name方法的典型用法代碼示例。如果您正苦於以下問題:Python User.name方法的具體用法?Python User.name怎麽用?Python User.name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cfme.configure.access_control.User
的用法示例。
在下文中一共展示了User.name方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: login_admin
# 需要導入模塊: from cfme.configure.access_control import User [as 別名]
# 或者: from cfme.configure.access_control.User import name [as 別名]
def login_admin(self, **kwargs):
"""
Convenience function to log into CFME using the admin credentials from the yamls.
Args:
kwargs: A dict of keyword arguments to supply to the :py:meth:`login` method.
"""
username = conf.credentials['default']['username']
password = conf.credentials['default']['password']
cred = Credential(principal=username, secret=password)
from cfme.configure.access_control import User
user = User(credential=cred)
user.name = 'Administrator'
self.login(user, **kwargs)
示例2: test_bad_password
# 需要導入模塊: from cfme.configure.access_control import User [as 別名]
# 或者: from cfme.configure.access_control.User import name [as 別名]
def test_bad_password(context, request, appliance):
""" Tests logging in with a bad password. """
username = conf.credentials['default']['username']
password = "[email protected]#$"
cred = Credential(principal=username, secret=password)
user = User(credential=cred)
user.name = 'Administrator'
if appliance.version.is_in_series('5.7'):
error_message = "Sorry, the username or password you entered is incorrect."
else:
error_message = "Incorrect username or password"
with appliance.context.use(context):
with error.expected(error_message):
appliance.server.login(user)
示例3: test_bad_password
# 需要導入模塊: from cfme.configure.access_control import User [as 別名]
# 或者: from cfme.configure.access_control.User import name [as 別名]
def test_bad_password(request):
""" Tests logging in with a bad password. """
appliance = get_or_create_current_appliance()
request.addfinalizer(lambda: navigate_to(appliance.server, 'LoginScreen'))
login_page = navigate_to(appliance.server, 'LoginScreen')
username = conf.credentials['default']['username']
password = "[email protected]#$"
cred = Credential(principal=username, secret=password)
user = User(credential=cred)
user.name = 'Administrator'
with error.expected("Sorry, the username or password you entered is incorrect."):
login_page.log_in(user)
assert login.page.is_displayed
示例4: login
# 需要導入模塊: from cfme.configure.access_control import User [as 別名]
# 或者: from cfme.configure.access_control.User import name [as 別名]
def login(self, user=None, method=LOGIN_METHODS[-1]):
"""
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
"""
# Circular import
if not user:
username = conf.credentials['default']['username']
password = conf.credentials['default']['password']
cred = Credential(principal=username, secret=password)
from cfme.configure.access_control import User
user = User(credential=cred, name='Administrator')
logged_in_view = self.appliance.browser.create_view(BaseLoggedInPage)
if not logged_in_view.logged_in_as_user(user):
if logged_in_view.logged_in:
logged_in_view.logout()
from cfme.utils.appliance.implementations.ui import navigate_to
login_view = navigate_to(self.appliance.server, 'LoginScreen')
time.sleep(1)
logger.debug('Logging in as user %s', user.credential.principal)
login_view.flush_widget_cache()
login_view.log_in(user, method=method)
logged_in_view.flush_widget_cache()
user.name = logged_in_view.current_fullname
try:
assert logged_in_view.is_displayed
assert logged_in_view.logged_in_as_user
self.appliance.user = user
except AssertionError:
login_view.flash.assert_no_error()
return logged_in_view
示例5: test_bad_password
# 需要導入模塊: from cfme.configure.access_control import User [as 別名]
# 或者: from cfme.configure.access_control.User import name [as 別名]
def test_bad_password(request, appliance):
""" Tests logging in with a bad password. """
request.addfinalizer(lambda: navigate_to(appliance.server, 'LoginScreen'))
login_page = navigate_to(appliance.server, 'LoginScreen')
username = conf.credentials['default']['username']
password = "[email protected]#$"
cred = Credential(principal=username, secret=password)
user = User(credential=cred)
user.name = 'Administrator'
if appliance.version.is_in_series('5.7'):
error_message = "Sorry, the username or password you entered is incorrect."
else:
error_message = "Incorrect username or password"
with error.expected(error_message):
login_page.log_in(user)
assert login_page.is_displayed