当前位置: 首页>>代码示例>>Python>>正文


Python User.name方法代码示例

本文整理汇总了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)
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:15,代码来源:ui.py

示例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)
开发者ID:jkandasa,项目名称:integration_tests,代码行数:18,代码来源:test_login.py

示例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
开发者ID:RonnyPfannschmidt,项目名称:cfme_tests,代码行数:19,代码来源:test_login.py

示例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
开发者ID:jkandasa,项目名称:integration_tests,代码行数:46,代码来源:ui.py

示例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
开发者ID:dajohnso,项目名称:cfme_tests,代码行数:24,代码来源:test_login.py


注:本文中的cfme.configure.access_control.User.name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。