def test_windows_client_system_connection(core_session, agent_enrolled_windows_system_with_users, proxy_start_stop): """ This test verifies connection to a windows system using Client, Connectors Steps for this scenario: * Enroll a windows system. * stop the agent, start the connector and verify connection to the system (only connector is available) - Verify success * stop the connector verify connection to the system - Verify failure * Start the agent and verify connection to the system (only Agent is available) - Verify success * Start the connector and verify connection to the system (Both agent and connector are available) - Verify success """ """ Testrail Link: https://testrail.centrify.com/index.php?/cases/view/1293468 https://testrail.centrify.com/index.php?/cases/view/1293468 https://testrail.centrify.com/index.php?/cases/view/1293469 """ # verfiy the test is run with single thread. assert 'PYTEST_XDIST_WORKER_COUNT' not in os.environ, f'This test cannot be run with multiple threads due to starting and stopping connectors' enrolledsystems = agent_enrolled_windows_system_with_users winrm_session_as_admin = enrolledsystems[0]["Session"] resourceid = enrolledsystems[0]["ResourceId"] proxyid = enrolledsystems[0]["ProxyId"] proxycontrol = proxy_start_stop logger.info("stop the agent") winrm_helper.stop_agent(winrm_session_as_admin) logger.info("start the connector") proxycontrol(proxyid, True) logger.info("Testing connection to the computer, Connector is ready") result, success = ResourceManager.get_system_health(core_session, resourceid) assert success and result == 'OK', f"Unable to verify system is reachable {result} {success}" # stop Conector, healthe check Should fail logger.info("Stopping the connector") proxycontrol(proxyid, False) logger.info("Testing connection to the system") result, success = ResourceManager.get_system_health(core_session, resourceid) assert success and result != 'OK', f"cerify system is reachable {result} {success}" # Start agent logger.info("Starting the agent") winrm_helper.start_agent(winrm_session_as_admin) logger.info("Testing connection to the computer, agent is available.") result, success = ResourceManager.get_system_health(core_session, resourceid) assert success and result == 'OK', f"Unable to verify system is reachable {result} {success}" # verify account again, both connector and agent are running proxycontrol(proxyid, True) logger.info("Testing connection to the computer, both agent and connector are available") result, success = ResourceManager.get_system_health(core_session, resourceid) assert success and result == 'OK', f"Unable to verify system is reachable {result} {success}"
def test_add_windows_activity(core_session, add_single_system): """ :param core_session: Authenticated Centrify Session. TC: C2532 - Add Windows system without account """ user_name = core_session.get_user().get_login_name() 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}") result, success = ResourceManager.get_system_health(core_session, added_system_id) assert success and result == 'OK', 'failed to test connection with system' result, success = ResourceManager.get_system_health(core_session, added_system_id) assert result != 'Unreachable', f"system {added_system_id} is unreachable, API response result : {result}" logger.info(f"System health check was successful and API response result is: {result}") system_activity = ResourceManager.get_system_activity(core_session, added_system_id) assert f"{user_name} added system" in system_activity[0]['Detail'], f"no system activity found, API response " \ f"result {system_activity}" logger.info(f"System Activity successfully retrieved: {system_activity[0]['Detail']}")