def test_bulk_system_unenrolls_manually_single_system(core_session, core_ui, test_virtual_aapm_agent):
    agent, server_prefix = test_virtual_aapm_agent
    agent.enroll(core_session, True)
    result = RedrockController.get_system(core_session, agent.computerUuid)
    assert len(result) != 0
    system = result[0]["Row"]
    logger.info(agent.agentProfileId)
    logger.info(agent.resourceName)

    # Make sure agent has aapm feature
    _validate_aapm_agent_details(core_session, [agent.agentProfileId], True)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    assert ui.check_exists(GridCell(agent.resourceName)), "Missing server from view " + agent.resourceName

    ui.action('Unenroll', agent.resourceName)
    core_ui.switch_context(Modal('System Unenroll'))

    core_ui.button('Unenroll')

    logger.info(agent.agentProfileId)
    logger.info(agent.resourceName)
    # Test Unenroll should be successful and feature appm should be disabled
    assert _wait_for_systems_validation(core_session, [agent.agentProfileId], False)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    assert ui.check_exists(GridCell(agent.resourceName)), "Missing server from view " + agent.resourceName

    agent.enroll(core_session, True)
    ResourceManager.update_system(core_session, agent.computerUuid, system["Name"], system["FQDN"],
                                  system["ComputerClass"],
                                  allowautomaticlocalaccountmaintenance=True)
    _validate_aapm_agent_details(core_session, [agent.agentProfileId], True)

    ui.action('Unenroll', agent.resourceName)
    core_ui.switch_context(Modal('System Unenroll'))
    core_ui.uncheck("SkipIfAgentReconciliationEnabled")

    core_ui.button('Unenroll')

    # Test Unenroll should be successful and feature appm should be disabled
    assert _wait_for_systems_validation(core_session, [agent.agentProfileId], False)
def test_modify_directory(core_admin_ui, core_session, create_directory,
                          create_report):
    my_directory = create_directory(core_session, "TestDirName").split('/')[-1]
    # Does not need guid, already has one in the creation!

    my_report = create_report(core_session, "Select Name From Server")

    core_admin_ui.navigate('Reports')
    core_admin_ui.expect(
        GridCell(my_report['Name']),
        f"Expected to see created Report {my_report['Name']} in report")

    core_admin_ui.expect(TreeFolder("My Reports"),
                         "Unable to find My Reports Tab under Reports")
    shared_reports_button = core_admin_ui._searchAndExpect(
        TreeFolder("My Reports"), f'Expected to find My Reports Btn')
    shared_reports_button.try_click()
    core_admin_ui.expect(TreeFolder(my_directory),
                         f"The directory {my_directory} did not show up")

    core_admin_ui.right_click_action(TreeFolder(my_directory), "Modify")

    move_modal = Modal()
    core_admin_ui.switch_context(move_modal)
    core_admin_ui.close_modal('Cancel')
Ejemplo n.º 3
0
def test_checkout_password_for_unmanaged_account_from_system_page(
        core_session, setup_pas_system_for_unix, core_admin_ui):
    """
    TC: C2506 - Checkout password for unmanaged account from system page
    :param setup_pas_system_for_unix: Adds and yield UUID of a Unix system and account associated to it.
    :param core_admin_ui: Authenticated Centrify browser session with cloud admin credentials from core.yaml
    """
    added_system_id, account_id, sys_info = setup_pas_system_for_unix
    resource_data = Configs.get_environment_node('resources_data',
                                                 'automation_main')
    acc_password = resource_data['Unix_infrastructure_data']['password']
    ui = core_admin_ui
    ui.navigate('Resources', 'Systems')
    ui.search(sys_info[0])
    ui.click_row(sys_info[0])
    ui.right_click_action(
        Selector(By.XPATH, f'//tr[@test-id = "{account_id}"]'), 'Checkout')
    ui._waitUntilSettled()
    logger.info(
        f'checking out password for "test_user" account from Unix system {sys_info[0]}'
    )
    logger.info(
        f"Password checkout successful for account: {account_id} from 'Systems' page."
    )
    ui.switch_context(Modal())
    ui.button('Show Password')
    logger.info(
        "Successfully clicked on 'Show password' button to reveal the password."
    )
    password_field = ui.check_exists(
        ('XPATH', '//div[@itemid="passwordPlainText"]'))
    assert password_field, "Password field not available even after clicking 'Show password' button"
    logger.info(f"Password is visible after clicking 'Show password' button.")
def test_bulk_system_delete_no_secret_manually(clean_bulk_delete_systems_and_accounts, core_session, core_ui, list_of_created_systems, secret_cleaner):
    server_prefix, names_of_servers, server_ids = _make_two_servers_get_names(core_session, list_of_created_systems)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    for name in names_of_servers:
        assert ui.check_exists(GridCell(name)), "Server not found in grid " + name

    ui.action('Delete Systems', names_of_servers)
    core_ui.switch_context(Modal('Bulk System Delete'))

    core_ui.uncheck("SaveSecret")
    core_ui.button('Delete')

    core_ui.switch_context(ConfirmModal())
    core_ui.button('Yes')

    core_ui.switch_context(NoTitleModal())
    core_ui.button('Close')

    ResourceManager.wait_for_systems_to_delete_or_timeout(core_session, server_ids)

    assert len(ResourceManager.get_multi_added_account_ids(core_session, server_ids)) == 0, "All added accounts not removed"
    assert len(ResourceManager.get_multi_added_system_ids(core_session, server_ids)) == 0, "All added systems not removed"
def test_bulk_system_deletes_manually_single_system_and_secret(clean_bulk_delete_systems_and_accounts, core_session, core_ui, list_of_created_systems, secret_cleaner):
    server_prefix, names_of_servers, server_ids = _make_one_server_get_name(core_session, list_of_created_systems)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    for name in names_of_servers:
        assert ui.check_exists(GridCell(name)), "Missing server from view " + name

    ui.action('Delete', names_of_servers)
    core_ui.switch_context(Modal('System Delete'))

    secret_name = "secret_e2e_name_" + guid()
    core_ui.input("SecretName", secret_name)

    core_ui.button('Delete')

    ResourceManager.wait_for_systems_to_delete_or_timeout(core_session, server_ids)
    assert len(ResourceManager.get_multi_added_account_ids(core_session, server_ids)) == 0, "All added accounts not removed"
    assert len(ResourceManager.get_multi_added_system_ids(core_session, server_ids)) == 0, "All added systems not removed"

    ResourceManager.wait_for_secret_to_exist_or_timeout(core_session, secret_name)

    secret_id = RedrockController.get_secret_id_by_name(core_session, secret_name)
    assert secret_id is not None, "Secret not found"
    secret_cleaner.append(secret_id)
def test_bulk_system_deletes_manually_from_set(clean_bulk_delete_systems_and_accounts, core_session, core_ui, list_of_created_systems):
    server_prefix, names_of_servers, server_ids = _make_two_servers_get_names(core_session, list_of_created_systems)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    not_favorite_stars = ui.browser.get_list_of_elements_by_css_selector("img.server-is-not-favorite")
    assert len(not_favorite_stars) == 2, "Expected two favorite stars to be found, but other number returned"

    for star in not_favorite_stars:
        star.click()  # favorite server

    core_ui.set_action("Favorites", "Delete Systems")

    core_ui.switch_context(Modal('Bulk System Delete'))
    core_ui.button('Delete')

    core_ui.switch_context(NoTitleModal())
    core_ui.button('Close')

    ResourceManager.wait_for_systems_to_delete_or_timeout(core_session, server_ids)

    assert len(ResourceManager.get_multi_added_account_ids(core_session, server_ids)) == 0, "All added accounts not removed"
    assert len(ResourceManager.get_multi_added_system_ids(core_session, server_ids)) == 0, "All added systems not removed"
def test_view_report_with_parameters_basic(core_admin_ui, core_session,
                                           create_report, create_resources):
    sys = create_resources(core_session, 1, 'Unix')[0]

    my_report = create_report(
        core_session,
        f"Select Name From Server Where Server.Name = @CompNamePlz")

    core_admin_ui.navigate('Reports')
    core_admin_ui.action('Modify', my_report['Name'])
    core_admin_ui.tab("Parameters")
    core_admin_ui.launch_modal('Add', "Report Parameter")

    core_admin_ui.input("Name", "CompNamePlz")
    core_admin_ui.input("Label", "Please Slap me with that Computer Name")
    core_admin_ui.select_option('Type', "String")
    core_admin_ui.close_modal("OK")

    core_admin_ui.launch_modal('Preview', "Required Parameters")

    core_admin_ui.input("CompNamePlz", sys['Name'])
    core_admin_ui.close_modal("OK")

    core_admin_ui.switch_context(Modal("Report Preview"))
    core_admin_ui.expect(GridCell(sys['Name']),
                         f"Failed to find {sys['Name']} row in Systems")
    core_admin_ui.close_modal('Close')
Ejemplo n.º 8
0
def test_bulk_account_deletes_with_ui_no_secret(
        clean_bulk_delete_systems_and_accounts, core_session, core_admin_ui,
        list_of_created_systems):
    server_prefix, account_prefix, all_systems, all_accounts, all_account_names = _make_four_accounts_get_names(
        core_session, list_of_created_systems, ssh=True)

    ui = core_admin_ui
    ui.navigate('Resources', 'Accounts')
    ui.search(server_prefix)

    for name in all_account_names:
        assert ui.check_exists(
            GridCell(name)), f"Account name {name} not found in grid"

    ui.action('Delete accounts', all_account_names)
    ui.switch_context(Modal('Bulk Account Delete'))
    ui.uncheck("SaveSecret")
    ui.button('Delete')
    ui.switch_context(ConfirmModal())
    ui.button('Yes')
    ui.switch_context(InfoModal())
    ui.button('Close')

    ResourceManager.wait_for_accounts_to_delete_or_timeout(
        core_session, all_systems, all_accounts)

    assert len(
        ResourceManager.get_multi_added_account_ids(
            core_session, all_systems)) == 0, "All added accounts not removed"
    assert len(
        ResourceManager.get_multi_added_system_ids(
            core_session,
            all_systems)) == 2, "Wrong number of added systems remain"
def test_email_report(core_admin_ui, core_session, create_report):
    my_report = create_report(core_session, "Select Name From Server")

    core_admin_ui.navigate('Reports')
    core_admin_ui.action('Email Report', my_report['Name'])
    core_admin_ui.switch_context(Modal('Email Report'))
    core_admin_ui.input("emailTo", "*****@*****.**")
    core_admin_ui.close_modal("OK")
    core_admin_ui.expect(
        GridCell(my_report['Name']),
        f"Expected to see created Report {my_report['Name']} in report")
Ejemplo n.º 10
0
def test_bulk_account_delete_uncertain_password(
        clean_bulk_delete_systems_and_accounts, core_session, core_admin_ui,
        list_of_created_systems, cleanup_accounts):
    accounts_list, roles_list, users_list, coid_list = cleanup_accounts
    server_prefix, account_prefix, all_systems, all_accounts, all_accounts_names = \
        _make_four_uncertain_accounts_get_names(
            core_session, accounts_list, list_of_created_systems)
    ui = core_admin_ui

    ui.navigate('Resources', 'Accounts')
    ui.search(server_prefix)

    uncertain_account = all_accounts_names[0]
    ui.check_exists(GridCell(uncertain_account)
                    ), f"Account name {uncertain_account} not found in grid"

    ui.action('Delete', uncertain_account)

    # Uncertain accounts should follow the old flow where the user can choose to view two different passwords,
    # only one of which is correct.
    view_password_modal = Modal(f'Delete Account: {uncertain_account}')
    ui.switch_context(view_password_modal)

    proposed_container = Component('propsedContainer')
    expected_container = Component('currentContainer')

    ui.button('Show Password', [RestCallInitiated(), proposed_container])

    ui.expect(
        proposed_container,
        f'Failed to find container which has expected password when in uncertain state'
    )

    ui.switch_context(proposed_container)

    proposedPassword = ComponentWithText('passwordPlainText', 'PendingSecret')

    ui.button('Show Password', [RestCallInitiated(), proposedPassword])
    ui.expect(
        proposedPassword,
        f'Failed to find expected PendingSecret password proposedPassword {proposedPassword.locator}'
    )

    ui.switch_context(expected_container)
    expectedPassword = ComponentWithText('passwordPlainText', 'CurrentSecret')
    ui.button('Show Password', [RestCallInitiated(), expectedPassword])
    ui.expect(expectedPassword,
              f'Failed to find expected CurrentSecret password')

    ui.switch_context(view_password_modal)
    ui.button('Close')
def test_move_report_different(core_admin_ui, core_session, create_report,
                               create_resources):
    my_report = create_report(core_session, "Select Name From Server")
    core_admin_ui.navigate('Reports')
    core_admin_ui.action('Move', my_report['Name'])
    move_modal = Modal("Move: " + my_report['Name'])
    core_admin_ui.switch_context(move_modal)
    core_admin_ui.expect(Button("Move"), f"Expected to see a Move button")
    core_admin_ui.down()
    core_admin_ui.close_modal("Move")
    # Expect to see the report in shared
    core_admin_ui.expect(
        GridCell(my_report['Name']),
        f"Expected to see created Report {my_report['Name']} in reports")
def test_move_report_to_same_dir(core_admin_ui, core_session, create_report,
                                 create_resources):
    my_report = create_report(core_session, "Select Name From Server")
    core_admin_ui.navigate('Reports')
    core_admin_ui.action('Move', my_report['Name'])
    move_modal = Modal(f'Move: {my_report["Name"]}')
    core_admin_ui.switch_context(move_modal)
    core_admin_ui.button("Move")
    core_admin_ui.switch_context(ConfirmModal())
    core_admin_ui.close_modal("No")
    # core_admin_ui.button("Move")  #TODO: Seems that the fixture fails when moved to the same directory, seems awry
    # core_admin_ui.button("Yes")
    core_admin_ui.expect(
        GridCell(my_report['Name']),
        f"Expected to see created Report {my_report['Name']} in report")
Ejemplo n.º 13
0
def test_ui_check_bulk_delete_account_scheduled(core_session, core_admin_ui,
                                                list_of_created_systems):
    """
    Test case: C3088
               :param core_session: Returns API session
               :param core_admin_ui: Centrify admin Ui session
               :param list_of_created_systems: creating a empty list of created systems.
               """
    account_name_prefix = f'account_test{guid()}'

    # adding multiple systems with accounts
    result = ResourceManager.add_multiple_systems_with_accounts(
        core_session,
        1,
        2,
        list_of_created_systems,
        user_prefix=account_name_prefix)

    # arranging the results in the lists
    all_systems, all_accounts = DataManipulation.aggregate_lists_in_dict_values(
        [result])
    ui = core_admin_ui
    ui.navigate('Resources', 'Accounts')
    account_names = []
    for account in all_accounts:
        # getting the account information
        query_result, query_success = ResourceManager.get_account_information(
            core_session, account)
        account_names.append(query_result['VaultAccount']['Row']['User'])

    ui.search(account_name_prefix)
    ui.action('Delete accounts', account_names)
    ui.switch_context(Modal('Bulk Account Delete'))
    ui.uncheck("SaveSecret")
    ui.button('Delete')
    ui.switch_context(ConfirmModal())
    ui.button('Yes')
    ui.switch_context(InfoModal())
    ui.expect(
        Div("A delete operation has been scheduled. You will receive an e-mail when the operation has been completed."
            ), "Expecting a info popup for delete schedule")
    logger.info("Popup with delete operation has been scheduled appeared")
    ui.button('Close')
    result, success = ResourceManager.del_multiple_systems(
        core_session, all_systems)
    assert success is True, 'Delete systems job failed when expected success'
    logger.info(f"Delete systems job executed successfully {result}")
Ejemplo n.º 14
0
def test_bulk_account_stores_secret_when_deleting_using_ui(
        clean_bulk_delete_systems_and_accounts, core_session, core_admin_ui,
        list_of_created_systems, secret_cleaner):
    server_prefix, account_prefix, all_systems, all_accounts, all_account_names = _make_four_accounts_get_names(
        core_session, list_of_created_systems, ssh=True)

    ui = core_admin_ui
    ui.navigate('Resources', 'Accounts')
    ui.search(server_prefix)

    for name in all_account_names:
        assert ui.check_exists(
            GridCell(name)), f"Account not found in grid with name {name}"

    delete_names, keep_names = DataManipulation.shuffle_and_split_into_two_lists(
        all_account_names)

    action_name = 'Delete accounts'
    modal_name = 'Bulk Account Delete'
    if len(delete_names) == 1:
        action_name = 'Delete'
        modal_name = 'Delete'

    ui.action(action_name, delete_names)
    ui.switch_context(Modal(modal_name))

    secret_name = "secret_e2e_name_" + guid() + "_" + guid()
    ui.input("SecretName", secret_name)

    ui.button('Delete')

    ui.switch_context(NoTitleModal())
    ui.button('Close')

    ResourceManager.wait_for_secret_to_exist_or_timeout(
        core_session, secret_name)

    secret_id = RedrockController.get_secret_id_by_name(
        core_session, secret_name)
    assert secret_id is not None, "Failed to create secret!"
    secret_cleaner.append(secret_id)

    assert len(
        ResourceManager.get_multi_added_account_ids(
            core_session, all_systems)) == len(
                keep_names), "Wrong number of remaining systems found"
Ejemplo n.º 15
0
def test_account_system_deletes_from_ui_using_set(
        clean_bulk_delete_systems_and_accounts, core_session, core_admin_ui,
        list_of_created_systems):
    server_prefix, account_prefix, all_systems, all_accounts, all_account_names = _make_four_accounts_get_names(
        core_session, list_of_created_systems, ssh=True)
    ui = core_admin_ui
    ui.navigate('Resources', 'Accounts')
    ui.search(server_prefix)

    favorite_stars = ui.browser.get_list_of_elements_by_css_selector(
        "img.server-is-not-favorite")
    assert len(
        favorite_stars
    ) == 4, "Expected 4 favorite stars to exist but wrong number found"

    for account_id in all_accounts:
        notFavoriteStar = FavoriteStar().inside(GridRowByGuid(account_id))
        favoritedStar = FavoritedStar().inside(GridRowByGuid(account_id))
        star = ui._searchAndExpect(
            notFavoriteStar,
            f'Failed to find unselected favorite star for {account_id} account'
        )
        star.try_click(
            (RestCallInitiated(), favoritedStar))  # favorite account
        ui._searchAndExpect(
            favoritedStar,
            f'Expected {account_id} not-favorite start to turn to favorited.')

    ui.expect(RestCallComplete(),
              f'Expected rest call to favorite account to have completed.')

    ui.set_action("Favorite Accounts", "Delete accounts")

    ui.switch_context(Modal('Bulk Account Delete'))
    ui.button('Delete')

    ui.switch_context(NoTitleModal())
    ui.button('Close')

    ResourceManager.wait_for_accounts_to_delete_or_timeout(
        core_session, all_systems, all_accounts)

    assert len(
        ResourceManager.get_multi_added_account_ids(
            core_session, all_systems)) == 0, "All added accounts not removed"
def test_ui_check_bulk_delete_account_confirm(core_session, core_admin_ui,
                                              list_of_created_systems):
    """
         Test case: C3087
               :param core_session: Returns API session
               :param core_admin_ui: Centrify admin Ui session
               :param list_of_created_systems: creating a empty list of created systems.
               """
    account_name_prefix = f'account_test{guid()}'

    # adding multiple systems with accounts
    result = ResourceManager.add_multiple_systems_with_accounts(
        core_session,
        1,
        2,
        list_of_created_systems,
        user_prefix=account_name_prefix)

    # arranging the results in the lists
    all_systems, all_accounts = DataManipulation.aggregate_lists_in_dict_values(
        [result])
    ui = core_admin_ui
    ui.navigate('Resources', 'Accounts')
    account_names = []
    for account in all_accounts:
        # getting the account information
        query_result, query_success = ResourceManager.get_account_information(
            core_session, account)
        account_names.append(query_result['VaultAccount']['Row']['User'])
    ui.search(account_name_prefix)
    ui.action('Delete accounts', account_names)
    ui.switch_context(Modal('Bulk Account Delete'))
    ui.uncheck("SaveSecret")
    ui.button('Delete')
    ui.switch_context(ConfirmModal())
    ui.expect(
        Div("You are about to delete accounts which contain passwords or SSH Keys. This cannot be undone. Are "
            "you sure you want to continue?"),
        "Expecting a confirm delete account popup")
    logger.info("Confirm delete accounts popup appeared.")
    ui.button('Yes')
    result, success = ResourceManager.del_multiple_systems(
        core_session, all_systems)
    assert success is True, 'Delete systems job failed when expected success'
    logger.info(f"Delete systems job executed successfully {result}")
Ejemplo n.º 17
0
def test_ui_check_bulk_delete_account_caution(core_session, core_admin_ui,
                                              list_of_created_systems):
    """
         Test case: C3086
               :param core_session: Returns API session
               :param core_admin_ui: Centrify admin Ui session
               :param list_of_created_systems: creating a empty list of created systems.
               """
    account_name_prefix = f'account_test{guid()}'

    # adding multiple systems with accounts
    result = ResourceManager.add_multiple_systems_with_accounts(
        core_session,
        1,
        2,
        list_of_created_systems,
        user_prefix=account_name_prefix)

    # arranging the results in the lists
    all_systems, all_accounts = DataManipulation.aggregate_lists_in_dict_values(
        [result])
    ui = core_admin_ui
    ui.navigate('Resources', 'Accounts')
    account_names = []
    for account in all_accounts:
        # getting the account information
        query_result, query_success = ResourceManager.get_account_information(
            core_session, account)
        account_names.append(query_result['VaultAccount']['Row']['User'])
    ui.search(account_name_prefix)
    ui.action('Delete accounts', account_names)
    ui.switch_context(Modal('Bulk Account Delete'))
    ui.expect(Label("Save password to secret"),
              "Expected to see the label of save the password")
    ui.expect(
        Div("Deleting an account means we will no longer know the password."
            " Saving deleted account passwords to a secret is recommended until you are sure they are "
            "no longer needed."), "Expected to see the Caution message.")
    result, success = ResourceManager.del_multiple_systems(
        core_session, all_systems)
    assert success is True, f'Delete systems job failed when expected success'
    logger.info(f"Delete systems job executed successfully {result}")
    result_acc, success_acc = ResourceManager.del_multiple_accounts(
        core_session, all_accounts)
    assert success_acc, f"Api did not complete successfully for bulk account delete MSG:{result_acc}"
def test_bulk_system_deletes_mixed_ssh_systems(clean_bulk_delete_systems_and_accounts, core_session, core_ui, list_of_created_systems, secret_cleaner):
    server_prefix, names_of_servers, server_ids = _make_two_servers_get_names(core_session, list_of_created_systems, ssh=True)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    for name in names_of_servers:
        assert ui.check_exists(GridCell(name)), "Missing server from view " + name

    ui.action('Delete Systems', names_of_servers)
    core_ui.switch_context(Modal('Bulk System Delete'))
    core_ui.button('Delete')
    core_ui.switch_context(InfoModal())
    core_ui.button('Close')

    ResourceManager.wait_for_systems_to_delete_or_timeout(core_session, server_ids)

    assert len(ResourceManager.get_multi_added_account_ids(core_session, server_ids)) == 0, "All added accounts not removed"
    assert len(ResourceManager.get_multi_added_system_ids(core_session, server_ids)) == 0, "All added systems not removed"
def test_create_report_directory(core_admin_ui, core_session, create_report):
    my_report = create_report(core_session, "Select Name From Server")

    core_admin_ui.navigate('Reports')
    core_admin_ui.expect(
        GridCell(my_report['Name']),
        f"Expected to see created Report {my_report['Name']} in report")
    core_admin_ui.right_click_action(TreeFolder("Shared Reports"),
                                     "New folder")

    folder_name = "new_folder" + guid()
    move_modal = Modal("Create new folder")
    core_admin_ui.switch_context(move_modal)
    core_admin_ui.input('file-name', folder_name)
    core_admin_ui.close_modal('Save')
    core_admin_ui.remove_context()
    try:
        core_admin_ui.expect(TreeFolder(folder_name),
                             f'Expected to find My Reports Btn')
    finally:
        del_directory_result = \
            core_session.apirequest(EndPoints.DELETE_DIRECTORY, {"path": "/Reports/" + folder_name}).json()
        assert del_directory_result['success'], \
            f"Unable to Delete Report {folder_name}, response {json.dumps(del_directory_result)}"
Ejemplo n.º 20
0
def test_account_settings_Policy_page(core_session, pas_setup, core_admin_ui,
                                      update_tenant_remote):
    """C2543 Update Account Settings page
            Steps:
                Pre: Create system with 1 account hand
                1. Try to update description for account
                    -Assert Failure
        """
    ui = core_admin_ui
    # Disable 'Allow access from a public network' policy on Global Security Setting page
    result, success = update_tenant_remote(core_session, False)
    assert success, f"Not able to disable 'Allow access from a public network' policy on Global Security Setting " \
                    f"page. API response result: {result}. "
    logger.info(
        f"'Allow access from a public network' policy disabled on Global Security Setting page"
    )
    system_id, account_id, sys_info = pas_setup
    description = f'{sys_info[0]}{guid()}'
    logger.info(
        f"System: {sys_info[0]} successfully added with UUID: {system_id} and account: {sys_info[4]} "
        f"with UUID: {account_id} associated with it.")
    ui.navigate('Resources', 'Accounts')
    ui.search(sys_info[0])
    ui.click_row(sys_info[0])
    ui.tab('Settings')

    # Step1: Update the description and compare the description.
    ui.input('Description', description)
    ui.save()
    ui.expect(TextArea('Description', description),
              description,
              time_to_wait=15)
    logger.info(f"Update description for this account : {sys_info[4]}")

    # Step2: Update the description and check weather Unsaved Changes pop is occurred without save.
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Update Password')
    ui.switch_context(ConfirmModal())
    ui.button('No')
    ui.switch_context(Modal('Update Unmanaged Password'))
    ui.button('Cancel')

    # Step3: Update the description and check weather Unsaved Changes pop is occurred without save.
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Update Password')
    ui.switch_context(ConfirmModal())
    ui.button('Cancel')

    # Step3: Update the description and check weather Unsaved Changes pop is occurred without save and \
    # update unmanaged password pop will occurred.
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Update Password')
    ui.switch_context(ConfirmModal())
    ui.button('Yes')
    ui.switch_context(Modal('Update Unmanaged Password'))
    ui.button('Cancel')

    # Step3: Update the description and check weather take rdp tab giving error.
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Login')
    ui.wait_for_tab_with_name(f"Login session {sys_info[0]}")
    expected_alert_message = "Remote access not allowed. Please enable the 'Allow access from a public network' " \
                             "policy if web login from a public network is required."
    ui.switch_to_pop_up_window()
    ui.switch_context(WarningModal())
    assert ui.check_exists((Div(expected_alert_message))), \
        f"pop up warning message for Remote access is not same as : {expected_alert_message}"
    logger.info(f"Correct pop up warning message displayed for Remote access.")
Ejemplo n.º 21
0
def test_system_settings_Policy_page(add_single_system, core_admin_ui):
    """C2540 Settings on Policy page
       trying to get rdp through system account with in 15 minute
            Steps:
                Pre: Create system
                1. Try to update description for system
                    -Assert Failure
        """

    ui = core_admin_ui
    added_system_id, sys_info = add_single_system
    logger.info(
        f"System {sys_info[0]}, with fqdn {sys_info[1]} created successfully with Uuid {added_system_id}"
    )
    description = f'{sys_info[0]}{guid()}'
    ui.navigate('Resources', 'Systems')
    ui.search(sys_info[0])
    ui.click_row(sys_info[0])
    ui.tab('Settings')

    # Step1: Update the description and compare the description
    ui.input('Description', description)
    ui.save()
    ui.expect(TextArea('Description', description),
              description,
              time_to_wait=15)
    logger.info(f"Update description for this System : {sys_info[0]}")

    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Select/Request Account')
    ui.switch_context(Modal(f'{sys_info[0]} Login'))
    ui.close_modal('Cancel')

    # Step2: Update the description and check weather Unsaved Changes pop is occurred without save
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Add To Set')
    ui.switch_context(ConfirmModal())
    ui.button("No")
    ui.switch_context(Modal('Add To Set'))
    ui.button('Cancel')

    # Step3: Update the description and check weather Unsaved Changes pop is occurred without save and \
    # Add to set pop will occurred
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Add To Set')
    ui.switch_context(ConfirmModal())
    ui.button('Yes')

    # Step4: Add to set name in windows system set
    ui.switch_context(Modal('Add To Set'))
    member_set_name = f'test_set_{guid()}'
    ui.tag_input('tagComboInput', member_set_name)
    ui.remove_context()
    ui.close_modal('Save')

    # Step3: Update the description and check weather Unsaved Changes pop is occurred without save and \
    # Add to set pop will occurred and then cancel
    ui.switch_context(ActiveMainContentArea())
    ui.input('Description', guid())
    ui.action('Add To Set')
    ui.switch_context(ConfirmModal())
    ui.button('Cancel')
def test_bulk_system_unenrolls_manually(core_session, core_ui, test_four_virtual_aapm_agents):
    agents, server_prefix = test_four_virtual_aapm_agents
    agent_ids, server_ids, names_of_servers = _setup_agents(core_session, agents)

    # Make sure aapm is enabled
    _validate_aapm_agent_details(core_session, agent_ids, True)

    # enable paswdRecon on first and last system
    result = RedrockController.get_system(core_session, server_ids[0])
    system = result[0]["Row"]
    ResourceManager.update_system(core_session, server_ids[0], system["Name"], system["FQDN"],
                                  system["ComputerClass"],
                                  allowautomaticlocalaccountmaintenance=True)

    result = RedrockController.get_system(core_session, server_ids[3])
    assert len(result) != 0
    system = result[0]["Row"]
    ResourceManager.update_system(core_session, server_ids[3], system["Name"], system["FQDN"],
                                  system["ComputerClass"],
                                  allowautomaticlocalaccountmaintenance=True)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    for name in names_of_servers:
        assert ui.check_exists(GridCell(name)), "Missing server from view " + name

    ui.action('Unenroll Systems', names_of_servers)
    core_ui.switch_context(Modal('Bulk System Unenroll'))
    core_ui.button('Unenroll')
    core_ui.switch_context(InfoModal())
    core_ui.button('Close')

    _wait_for_systems_validation(core_session, agent_ids[1:3], False)
    _validate_aapm_agent_details(core_session, agent_ids[:1], True)
    _validate_aapm_agent_details(core_session, agent_ids[3:], True)

    # Now lets re-enroll and enable aapm on 1 and 2 systems and run the unenroll operation
    # with SkipIfAgentReconciliationEnabled unchecked
    # Expected: Both systems should successfully unenroll

    _setup_agents(core_session, agents)

    # Make sure aapm is enabled on all systems
    _validate_aapm_agent_details(core_session, agent_ids, True)

    ui = core_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    for name in names_of_servers:
        assert ui.check_exists(GridCell(name)), "Missing server from view " + name

    ui.action('Unenroll Systems', names_of_servers)
    core_ui.switch_context(Modal('Bulk System Unenroll'))
    core_ui.uncheck("SkipIfAgentReconciliationEnabled")
    core_ui.button('Unenroll')
    core_ui.switch_context(InfoModal())
    core_ui.button('Close')

    _wait_for_systems_validation(core_session, agent_ids, False)
def test_bulk_system_unenrolls_manually_from_set(core_session, core_admin_ui, create_manual_set,
                                                 test_four_virtual_aapm_agents):
    agents, server_prefix = test_four_virtual_aapm_agents
    agent_ids, server_ids, names_of_servers = _setup_agents(core_session, agents)
    # Make sure aapm is enabled
    _wait_for_systems_validation(core_session, agent_ids, True)

    # enable paswdRecon on first system and last system
    result = RedrockController.get_system(core_session, server_ids[0])
    assert len(result) != 0
    system = result[0]["Row"]
    ResourceManager.update_system(core_session, server_ids[0], system["Name"], system["FQDN"],
                                  system["ComputerClass"],
                                  allowautomaticlocalaccountmaintenance=True)

    result = RedrockController.get_system(core_session, server_ids[3])
    assert len(result) != 0
    system = result[0]["Row"]
    ResourceManager.update_system(core_session, server_ids[3], system["Name"], system["FQDN"],
                                  system["ComputerClass"],
                                  allowautomaticlocalaccountmaintenance=True)

    # Non-ui stuff, create a custom set, and all the new systems to that set.
    manual_set = create_manual_set(core_session, "Server")
    update_success, update_result = SetsManager.update_members_collection(core_session, 'add', server_ids, 'Server',
                                                                          manual_set['ID'])
    assert update_success, f"Failed to add resources {server_ids} to Set {manual_set['Name']}"

    ui = core_admin_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    ui.set_action(manual_set['Name'], "Unenroll Systems")

    ui.switch_context(Modal('Bulk System Unenroll'))
    ui.button('Unenroll')
    ui.switch_context(NoTitleModal())
    ui.button('Close')

    _wait_for_systems_validation(core_session, agent_ids[1:3], False)
    _validate_aapm_agent_details(core_session, agent_ids[:1], True)
    _validate_aapm_agent_details(core_session, agent_ids[3:], True)

    # Now lets re-enroll and enable aapm on 1 and 2 systems and run the unenroll operation
    # with SkipIfAgentReconciliationEnabled unchecked
    # Expected: Both systems should successfully unenroll

    _setup_agents(core_session, agents)

    # Make sure aapm is enabled on all systems
    _validate_aapm_agent_details(core_session, agent_ids, True)

    ui = core_admin_ui
    ui.navigate('Resources', 'Systems')
    ui.search(server_prefix)

    ui.set_action(manual_set['Name'], "Unenroll Systems")

    ui.switch_context(Modal('Bulk System Unenroll'))
    ui.uncheck("SkipIfAgentReconciliationEnabled")
    ui.button('Unenroll')
    ui.switch_context(NoTitleModal())
    ui.button('Close')

    # Make sure aapm is disabled on both systems
    _wait_for_systems_validation(core_session, agent_ids, False)