def test_add_a_new_top_level_stand_alone_folder(core_session,
                                                create_secret_folder,
                                                pas_general_secrets):

    """
         Test method to create a Folder &
        verifying the  rights of the folder created
    :param core_session: Authenticated Centrify Session
    :param create_secret_folder: Fixture to create a folder & yields folder related details
    :param pas_general_secrets: Fixture to read secret data from yaml file

    """
    secret_folder_details = create_secret_folder
    folder_id = secret_folder_details['ID']

    # Getting the Id of the user.
    user_details = core_session.__dict__
    user_id = user_details['auth_details']['UserId']

    # Refreshing the page.
    refresh_result = UserManager.refresh_token(core_session, user_id)
    assert refresh_result["success"], f"Failed to reload:API response result:{refresh_result}"

    # Getting permissions of the folder created
    permissions = SetsManager.get_collection_rights(core_session, folder_id)
    verify_permissions = 'View, Edit, Delete, Grant, Add'
    assert verify_permissions == permissions["Result"], \
        f'Failed to verify permissions for the folder{permissions["Result"]}'
    logger.info(f'Permissions of the folder created: {permissions}')
Exemple #2
0
def test_checkout_lifetime_to_blank(core_session, pas_windows_setup):
    """
    TC:C2213 Set the Checkout lifetime to blank.
    :param core_session: Returns a API session.
    :param pas_windows_setup: Returns a fixture

    """
    # Getting the Id of the user.
    user_details = core_session.__dict__
    user_id = user_details['auth_details']['UserId']

    # Adding a system with account.
    system_id, account_id, sys_info, connector_id, user_password = pas_windows_setup(
    )

    # Setting the lifetime checkout to 15 min.
    checkout_lifetime = 15
    updated_account_result, update_account_success = \
        ResourceManager.update_account(core_session,
                                       account_id,
                                       sys_info[4],
                                       host=system_id,
                                       ismanaged=False,
                                       default_checkout_time=checkout_lifetime)

    assert update_account_success, f"Failed to add default checkout time: API response result:{updated_account_result}"
    logger.info(
        f'Successfully added default checkout time: {updated_account_result}"')

    # Checking the lifetime checkout value.
    account_info_result, account_info_success = ResourceManager.get_account_information(
        core_session, account_id)
    account_checkout_lifetime = account_info_result['VaultAccount']['Row'][
        'DefaultCheckoutTime']

    assert account_checkout_lifetime == checkout_lifetime, f'Failed to found default checkout time in account info: ' \
                                                           f'API response ' \
                                                           f'result:{account_info_result} '
    logger.info(
        f"Successfully Found check out time in account info: {account_checkout_lifetime}"
    )

    # Setting the lifetime checkout to blank.
    updated_account_result, update_account_success = ResourceManager.update_account(
        core_session,
        account_id,
        sys_info[4],
        host=system_id,
        ismanaged=False,
        default_checkout_time=None)
    assert update_account_success, f"Failed to update default checkout time to blank: " \
                                   f"API response result:{updated_account_result} "
    logger.info(
        f'Successfully updated default checkout time to blank:{updated_account_result}. '
    )

    # Checking the lifetime checkout value.
    account_info_result, account_info_success = ResourceManager.get_account_information(
        core_session, account_id)

    updated_account_checkout_lifetime = account_info_result['VaultAccount'][
        'Row']

    assert 'DefaultCheckoutTime' not in updated_account_checkout_lifetime, "DefaultCheckoutTime is present"

    logger.info(
        f"'DefaultCheckoutTime' is not present in account info: {updated_account_checkout_lifetime}"
    )

    # Refreshing the page.
    refresh_result = UserManager.refresh_token(core_session, user_id)
    assert refresh_result[
        "success"], f"Failed to reload:API response result:{refresh_result}"

    # Checking the lifetime value after refresh.
    modified_account_info_result, modified_account_info_success = ResourceManager. \
        get_account_information(core_session, account_id)

    modified_account_checkout_lifetime = modified_account_info_result[
        'VaultAccount']['Row']
    assert 'DefaultCheckoutTime' not in modified_account_checkout_lifetime, "DefaultCheckoutTime is present"

    logger.info(
        f"'DefaultCheckoutTime' is not present in account info: {updated_account_checkout_lifetime}"
    )