def create_users():
    logger.info('Create users')

    names = [TapObjectName(prefix='perf_user').as_email() for _ in range(config.num_clients)]
    for name in names:
        onboarding.onboard(context=PERFORMANCE_CONTEXT,
                           username=name,
                           password=config.admin_password,
                           org_guid=CORE_ORG.guid,
                           check_email=False)

    usernames_on_platform = (user.username for user in User.get_all_users(CORE_ORG.guid))
    assert set(names).issubset(set(usernames_on_platform)), 'Failed to create required number of users'

    os.environ['PT_PERF_USER_NAMES'] = ' '.join(names)
Exemple #2
0
def test_onboarding(context, test_org):
    """
    <b>Description:</b>
    Checks if user can be added to the platform with onboarding functionality.

    <b>Input data:</b>
    1. User email.

    <b>Expected results:</b>
    Test passes when user was successfully added to the platform with onboading functionality.

    <b>Steps:</b>
    1. Onboard new user to the platform.
    2. Get list of all users on the platform.
    3. Verify that the user is present on the platform.
    """
    step("Onboard new user")
    username = generate_test_object_name(email=True, separator="")
    test_user = onboarding.onboard(context=context,
                                   org_guid=test_org.guid,
                                   username=username,
                                   check_email=False)
    step("Check that user is created")
    users = User.get_all_users(test_org.guid)
    assert test_user in users
Exemple #3
0
def test_add_new_user_to_and_delete_from_org(core_org, context):
    """
    <b>Description:</b>
    Checks if admin user can be added and removed from the platform.

    <b>Input data:</b>
    1. User email.

    <b>Expected results:</b>
    Test passes when admin user was successfully added to the platform and removed from it.

    <b>Steps:</b>
    1. Onboard new user to the platform.
    2. Update user role to admin
    3. Verify the user is present in the organization.
    4. Remove the user from the organization.
    5. Verify that the user was removed from the organization.
    """
    step("Add new user to organization")
    username = generate_test_object_name(email=True, separator="")
    test_user = onboarding.onboard(context=context,
                                   org_guid=core_org.guid,
                                   username=username,
                                   check_email=False)
    test_user.update_org_role(org_guid=core_org.guid,
                              new_role=User.ORG_ROLE["admin"])
    step("Check that the user is added")
    users = User.get_list_in_organization(org_guid=core_org.guid)
    assert test_user in users
    step("Delete the user from the organization")
    test_user.delete_from_organization(org_guid=core_org.guid)
    step("Check that the user is not in the organization")
    users = User.get_list_in_organization(org_guid=core_org.guid)
    assert test_user not in users
 def user(self, context, test_org, cli_login):
     new_user = onboard(context=context,
                        org_guid=test_org.guid,
                        check_email=False)
     assert_in_with_retry(new_user,
                          User.get_all_users,
                          org_guid=test_org.guid)
     return new_user
Exemple #5
0
def test_onboarding(context):
    """Test Onboarding"""
    step("Onboard new user")
    test_user, test_org = onboarding.onboard(context, check_email=False)
    step("Check that user is created")
    users = User.cf_api_get_all_users()
    assert test_user in users
    step("Check that organization is created")
    org_list = Organization.api_get_list()
    assert test_org in org_list
    def test_users_cannot_see_hive_databases_for_other_orgs(
            self, test_org, admin_user, add_admin_to_test_org, context):
        org1 = test_org
        user1 = admin_user
        step("Create second user and organization")
        user2, org2 = onboard(context)
        org1_database_name = escape_hive_name(org1.guid)
        user1_databases = self._get_hive_databases(user1)
        org2_database_name = escape_hive_name(org2.guid)
        user2_databases = self._get_hive_databases(user2)

        assert org1_database_name not in user2_databases, "User can see the other user's database"
        assert org2_database_name not in user1_databases, "User can see the other user's database"
Exemple #7
0
def test_add_new_user_to_and_delete_from_space(core_org, core_space, context):
    """Add New User to and Delete from Space"""
    step("Add new user to space")
    test_user, test_org = onboarding.onboard(context, check_email=False)
    test_user.api_add_to_space(core_space.guid,
                               core_org.guid,
                               roles=User.SPACE_ROLES["manager"])
    step("Check that the user is added")
    users = User.api_get_list_via_space(space_guid=core_space.guid)
    assert test_user in users
    step("Remove the user from space")
    test_user.api_delete_from_space(space_guid=core_space.guid)
    step("Check that the user was deleted")
    users = User.api_get_list_via_space(space_guid=core_space.guid)
    assert test_user not in users
Exemple #8
0
def test_add_new_user_to_and_delete_from_org(core_org, context):
    """Add New User to and Delete from Organization"""
    step("Add new user to organization")
    test_user, test_org = onboarding.onboard(context, check_email=False)
    test_user.api_add_to_organization(
        core_org.guid,
        roles=User.ORG_ROLES["manager"],
    )
    step("Check that the user is added")
    users = User.api_get_list_via_organization(org_guid=core_org.guid)
    assert test_user in users
    step("Delete the user from the organization")
    test_user.api_delete_from_organization(org_guid=core_org.guid)
    step("Check that the user is in the organization")
    users = User.api_get_list_via_organization(org_guid=core_org.guid)
    assert test_user not in users