def new_user(appliance, groups, name=None, credential=None):
    from cfme.fixtures.blockers import bug

    uppercase_username_bug = bug(1487199)

    name = name or 'user{}'.format(fauxfactory.gen_alphanumeric())
    credential = credential or new_credential()

    user = appliance.collections.users.create(name=name,
                                              credential=credential,
                                              email='*****@*****.**',
                                              groups=groups,
                                              cost_center='Workload',
                                              value_assign='Database')

    # Version 5.8.2 has a regression blocking logins for usernames w/ uppercase chars
    if '5.8.2' <= user.appliance.version < '5.9' and uppercase_username_bug:
        user.credential.principal = user.credential.principal.lower()

    return user
def new_user(appliance, groups, name=None, credential=None):
    from cfme.fixtures.blockers import bug

    uppercase_username_bug = bug(1487199)

    name = name or 'user{}'.format(fauxfactory.gen_alphanumeric())
    credential = credential or new_credential()

    user = appliance.collections.users.create(
        name=name,
        credential=credential,
        email='*****@*****.**',
        groups=groups,
        cost_center='Workload',
        value_assign='Database')

    # Version 5.8.2 has a regression blocking logins for usernames w/ uppercase chars
    if '5.8.2' <= user.appliance.version < '5.9' and uppercase_username_bug:
        user.credential.principal = user.credential.principal.lower()

    return user