def test_userid_required_error_validation():
    user = ac.User(name='user' + random.generate_random_string(),
                   credential=Credential(principal=None, secret='redhat'),
                   email='*****@*****.**',
                   group=group_user)
    with error.expected("Userid can't be blank"):
        user.create()
def new_user(group=usergrp):
    return ac.User(name='user' + random.generate_random_string(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=group,
                   cost_center='Workload',
                   value_assign='Database')
def test_userid_required_error_validation():
    user = ac.User(name='user' + fauxfactory.gen_alphanumeric(),
                   credential=Credential(principal=None, secret='redhat'),
                   email='*****@*****.**',
                   group=group_user)
    with error.expected("Userid can't be blank"):
        user.create()
def vm_ownership(enable_candu, clean_setup_provider, provider):
    # In these tests, chargeback reports are filtered on VM owner.So,VMs have to be
    # assigned ownership.
    vm_name = provider.data['cap_and_util']['chargeback_vm']

    if not provider.mgmt.does_vm_exist(vm_name):
        pytest.skip("Skipping test, cu-24x7 VM does not exist")
    if not provider.mgmt.is_vm_running(vm_name):
        provider.mgmt.start_vm(vm_name)
        provider.mgmt.wait_vm_running(vm_name)

    cb_group = ac.Group(description='EvmGroup-user')
    user = ac.User(name=provider.name + fauxfactory.gen_alphanumeric(),
        credential=new_credential(),
        email='*****@*****.**',
        group=cb_group,
        cost_center='Workload',
        value_assign='Database')

    vm = VM.factory(vm_name, provider)

    try:
        user.create()
        vm.set_ownership(user=user.name)
        logger.info('Assigned VM OWNERSHIP for {} running on {}'.format(vm_name, provider.name))

        yield user.name
    finally:
        vm.unset_ownership()
        user.delete()
def test_username_required_error_validation():
    user = ac.User(name=None,
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=group_user)
    with error.expected("Name can't be blank"):
        user.create()
def test_user_group_error_validation():
    user = ac.User(name='user' + random.generate_random_string(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=None)
    with error.expected("A User must be assigned to a Group"):
        user.create()
def new_user(group=usergrp):
    return ac.User(name='user' + fauxfactory.gen_alphanumeric(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=group,
                   cost_center='Workload',
                   value_assign='Database')
def test_user_change_password(request):
    user = ac.User(
        name="user {}".format(fauxfactory.gen_alphanumeric()),
        credential=Credential(principal="user_principal_{}".format(
            fauxfactory.gen_alphanumeric()),
                              secret="very_secret",
                              verify_secret="very_secret"),
        email="*****@*****.**",
        group=usergrp,
    )
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(login.login_admin)
    with user:
        assert not login.logged_in()
        login.login(user)
        assert login.current_full_name() == user.name
    login.login_admin()
    with update(user):
        user.credential = Credential(
            principal=user.credential.principal,
            secret="another_very_secret",
            verify_secret="another_very_secret",
        )
    with user:
        assert not login.logged_in()
        login.login(user)
        assert login.current_full_name() == user.name
def test_user_group_error_validation():
    user = ac.User(name='user' + fauxfactory.gen_alphanumeric(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=None)
    with error.expected("A User must be assigned to a Group"):
        user.create()
def test_user_email_error_validation():
    user = ac.User(name='user' + fauxfactory.gen_alphanumeric(),
                   credential=new_credential(),
                   email='xyzdhat.com',
                   group=group_user)
    with error.expected("Email must be a valid email address"):
        user.create()
def test_user_email_error_validation():
    user = ac.User(name='user' + random.generate_random_string(),
                   credential=new_credential(),
                   email='xyzdhat.com',
                   group=group_user)
    with error.expected("Email must be a valid email address"):
        user.create()
def new_user(new_group):
    user = ac.User(name='user_' + fauxfactory.gen_alphanumeric(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=new_group)
    user.create()
    yield user
    user.appliance.server.login_admin()
    user.delete()
def new_user(group_only_user_owned):
    user = ac.User(name='user_' + fauxfactory.gen_alphanumeric(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=group_only_user_owned,
                   cost_center='Workload',
                   value_assign='Database')
    user.create()
    return user
def test_user_password_required_error_validation():
    user = ac.User(
        name='user' + fauxfactory.gen_alphanumeric(),
        credential=Credential(principal='uid' + fauxfactory.gen_alphanumeric(), secret=None),
        email='*****@*****.**',
        group=group_user)
    if version.current_version() < "5.5":
        check = "Password_digest can't be blank"
    else:
        check = "Password can't be blank"
    with error.expected(check):
        user.create()
def test_delete_default_user():
    """Test for deleting default user Administrator.

    Steps:
        * Login as Administrator user
        * Try deleting the user
    """
    user = ac.User(name='Administrator')
    sel.force_navigate("cfg_accesscontrol_users")
    column = version.pick({version.LOWEST: "Name", "5.4": "Full Name"})
    row = records_table.find_row_by_cells({column: user.name})
    sel.check(sel.element(".//input[@type='checkbox']", root=row[0]))
    tb.select('Configuration', 'Delete selected Users', invokes_alert=True)
    sel.handle_alert()
    flash.assert_message_match(
        'Default EVM User "{}" cannot be deleted'.format(user.name))
def test_current_user_login_delete(request):
    """Test for deleting current user login.

    Steps:
        * Login as Admin user
        * Create a new user
        * Login with the new user
        * Try deleting the user
    """
    group_user = ac.Group("EvmGroup-super_administrator")
    user = ac.User(name='user' + fauxfactory.gen_alphanumeric(),
                   credential=new_credential(),
                   email='*****@*****.**',
                   group=group_user)
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(login.login_admin)
    with user:
        with error.expected("Current EVM User \"{}\" cannot be deleted".format(
                user.name)):
            user.delete()
Beispiel #17
0
def vm_ownership(enable_candu, clean_setup_provider, provider):
    # In these tests, chargeback reports are filtered on VM owner.So,VMs have to be
    # assigned ownership.
    try:
        vm_name = provider.data['cap_and_util']['chargeback_vm']
        vm = VM.factory(vm_name, provider)

        cb_group = ac.Group(description='EvmGroup-user')
        user = ac.User(name=provider.name + fauxfactory.gen_alphanumeric(),
                       credential=new_credential(),
                       email='*****@*****.**',
                       group=cb_group,
                       cost_center='Workload',
                       value_assign='Database')
        user.create()
        vm.set_ownership(user=user.name)
        logger.info('ASSIGNED VM OWNERSHIP FOR {} RUNNING ON {}'.format(
            vm_name, provider.name))

        yield user.name
    finally:
        vm.unset_ownership()
        user.delete()