Exemple #1
0
def test_password_checkin_from_my_password_checkout_field(
        core_session, pas_setup, core_admin_ui):
    """
        Test case: C14838
        :param core_session: Centrify session
        :param pas_setup: fixture to create system with account
        :param core_admin_ui: UI session
    """
    system_id, account_id, system_info = pas_setup
    result, status = ResourceManager.check_out_password(
        core_session, 1, account_id, 'test checkout account')
    assert status, f'failed to checkout password for account {system_info[4]}, returned result is: {result}'

    ui = core_admin_ui
    ui.navigate(('Workspace', 'My Password Checkouts'))
    ui.expect(
        GridCell(f'{system_info[4]} ({system_info[0]})'),
        f'expected to find checkout details for account '
        f'{system_info[4]} but did not')
    logger.info(
        f'found details for account {system_info[4]} in My Password Checkout view'
    )

    ui.right_click_action(GridCell(f'{system_info[4]} ({system_info[0]})'),
                          'Checkin')
    ui.expect_disappear(
        GridCell(f'{system_info[4]} ({system_info[0]})'),
        f'Expacted to find no records for '
        f'{system_info[4]} in My Password Checkout, but found one')
    logger.info(f'successfully checkin password for account {system_info[4]} ')
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')
def test_create_text_secret_works(core_ui, core_session, secret_cleaner):
    ui = core_ui

    secret_name = guid() + ' ui secret'
    secret_description = secret_name + ' Description'
    secret_contents = guid() + ' secret contents'

    ui.navigate('Resources', 'Secrets')
    ui.launch_add('Add Secret')

    ui.input('SecretName', secret_name)
    ui.input('Description', secret_description)

    ui.save_warning()
    ui.select_option('Type', 'Text')

    ui.launch_modal('Enter Text')
    ui.input('SecretText', secret_contents)
    ui.close_modal('OK')

    ui.save()

    secret = find_secret_by_name(core_session, secret_name)
    secret_id = secret['ID']
    secret_cleaner.append(secret_id)

    ui.search(secret_name)
    ui.expect(GridCell(secret_name), 'Could not find secret after creating it')
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_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')
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)
Exemple #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")
Exemple #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_single_system_no_agent_enrolled(clean_bulk_delete_systems_and_accounts, core_session, core_ui,
                                         list_of_created_systems):
    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

    # Make sure unenroll operation is not available
    ui.check_actions(['Login', 'Select/Request Account', 'Enter Account', 'System',
                      'Add To Set', 'Test connection', 'Delete'], names_of_servers)
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")
Exemple #14
0
def test_check_my_password_checkout_field_after_checkout_account(core_session, pas_setup, core_admin_ui):
    """
    Test case: C14837
    :param core_session: Centrify session
    :param pas_setup: fixture to create system with account
    :param core_admin_ui: UI session
    """
    system_id, account_id, system_info = pas_setup

    result, status = ResourceManager.check_out_password(core_session, 1, account_id, 'test checkout account')
    assert status, f'failed to checkout password for account {system_info[4]}, returned result is: {result}'

    ui = core_admin_ui
    ui.navigate(('Workspace', 'My Password Checkouts'))
    ui.expect(GridCell(f'{system_info[4]} ({system_info[0]})'), f'expected to find checkout details for account '
                                                                f'{system_info[4]} but did not')
Exemple #15
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"
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_bulk_system_does_not_appear_as_pas_power_user(clean_bulk_delete_systems_and_accounts, core_session, list_of_created_systems, users_and_roles, right_data):
    server_prefix, names_of_servers, server_ids = _make_two_servers_get_names(core_session, list_of_created_systems)

    logger.info(f'Testing prefix: {server_prefix} names: {names_of_servers} ids: {server_ids}')
    ui = None
    try:
        ui = users_and_roles.get_ui_as_user(right_data[0])
        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.check_actions(right_data[1], names_of_servers)
    except Exception as e:
        logger.info("Taking screenshot of failed state.")
        raise e
    finally:
        if ui is not None:
            ui.browser.screen_cap('test_bulk_system_does_not_appear_as_pas_power_user')
            ui.browser.exit()
def test_bulk_system_unenroll_does_not_appear_as_pas_power_user(core_session, right_data, users_and_roles,
                                                                test_four_virtual_aapm_agents):
    agents, server_prefix = test_four_virtual_aapm_agents
    _, _, names_of_servers = _setup_agents(core_session, agents)

    logger.info(f'Testing prefix: {server_prefix} names: {names_of_servers}')
    ui = None
    try:
        ui = users_and_roles.get_ui_as_user(right_data[0])
        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.check_actions(right_data[1], names_of_servers)
    except Exception as e:
        logger.info("Taking screenshot of failed state.")
        raise e
    finally:
        if ui is not None:
            ui.browser.screen_cap('test_bulk_system_unenroll_does_not_appear_as_pas_power_user')
            ui.browser.exit()
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)}"
Exemple #20
0
def test_changed_unmanaged_to_managed(domain_config_data, get_admin_user_function, core_session, core_ui):
    """
    TCID: C1331, Add an unmanaged account without password and changed unmanaged to managed
    :return:
    """
    conf = domain_config_data
    name = conf['pas_bat_scenario1_infrastructure_data'][0]
    domain_name = name["Domain_name3"]
    script = "Select * FROM VaultDomain"
    request = RedrockController.redrock_query(core_session, script)
    directory_service_ID = None
    directory_service_Name = None
    directory_service_Admin_ID = None
    for directory_service in request:
        directory_service = directory_service['Row']
        if directory_service['Name'] == name["Domain_name3"]:
            directory_service_ID = directory_service['ID']
            directory_service_Name = directory_service['Name']
            directory_service_Admin_ID = directory_service['Administrator']
            break
    permissions = "Grant,View,Edit,Delete,AddAccount"

    result, add_domain_account_success = ResourceManager.set_domain_account_permissions(core_session, permissions,
                                                                                        "System Administrator",
                                                                                        "sysadmin",
                                                                                        id=directory_service_ID,
                                                                                        ptype="Role",

                                                                                        pvid=directory_service_ID,
                                                                                        rowkey=directory_service_ID)
    assert add_domain_account_success, f'Failed to set add account permission in the domain {result}'
    logger.info(f"add account permission set successfully in the Domain.")
    account, add_domain_success = ResourceManager.get_administrative_account(core_session, "administrator")
    logger.info(f" Successfully get Domain for adding Administrative account.")
    assert add_domain_success, f'Failed to get Domain account {account}'
    name = conf['pas_bat_scenario1_infrastructure_data']
    pvid = account[0]
    domains_name = account[0]
    domain_name_list = []
    for domain_name in name:
        for key, value in domain_name.items():
            domain_name_list.append(value)
    logger.info(f"Set Administrative account for Domain. {domain_name_list}")
    result, add_admin_account_success, message = ResourceManager.set_administrative_account(core_session,
                                                                                            domain_name_list,
                                                                                            pvid=pvid['PVID'],
                                                                                            user=domains_name[
                                                                                                'FullyQualifiedName'])
    assert add_admin_account_success, f'Failed to set administrative account {message}'
    logger.info(f"Administrative account Set successfully in the Domain.{message}")

    result, success = ResourceManager.update_domain_accounts(core_session, directory_service_Name,
                                                             directory_service_Admin_ID, directory_service_ID,
                                                             allowautomaticaccountmaintenance=True)
    assert success, f'failed to update the domain'
    logger.info(f"update account successfully in the Domain{result}")

    data = conf['pas_scenario1_new_accounts'][0]
    account_name = data['Managed_account']
    ui = core_ui
    ui.navigate("Resources", "Domains")
    ui.search(domain_name['Domain_name3'])
    ui.click_row(GridRow(domain_name['Domain_name3']))
    ui.user_menu("Reload Rights")
    ui._waitUntilSettled()
    ui.launch_modal("Add", modal_title="Add Account")
    ui.input("User", account_name)
    ui.uncheck("IsManaged")
    ui.button("Add")
    ui.expect(GridCell("Missing Password"), f'Password is not missing')

    ui.right_click(GridCell(account_name))
    right_click_values = ui.get_list_of_right_click_element_values("Update Password")
    assert "Checkout" not in right_click_values, f'Checkout option is appeared'
    logger.info(f"All right click option:{right_click_values}")
    account_id = None
    results = ServerManager.get_all_accounts(core_session)

    for result in results:
        if result['User'] == account_name:
            account_id = result['ID']

    added_account = ui._searchAndExpect(GridCell(account_name), f'account is not getting added')
    added_account.try_click()
    ui._waitUntilSettled()

    ui.tab("Settings")
    ui.check("IsManaged")

    ui.save()
    ui._waitUntilSettled()

    ui.expect(DisabledButton("Save"), f'Account did not get managed')

    result = RedrockController.get_account_activity(core_session, account_id)
    counter = 0
    while counter < 10:
        result = RedrockController.get_account_activity(core_session, account_id)
        if result[0]['Detail'].__contains__("SYSTEM$"):
            break
    counter += 1
    assert f'SYSTEM$ changed domain account "{account_name}" password for {domain_name["Domain_name3"]}' in result[0]['Detail'], f'could not able to change password'
    logger.info(f"All Activity's are: , {result}")
    result, success = ResourceManager.del_account(core_session, account_id)
    assert success, f'Account did not get delete{result}'
    logger.info(f"Account got deleted successfully, {result}")
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)