import sys
import time
from platform import mac_ver
from distutils.version import LooseVersion
from pybenutils.utils_logger.config_logger import get_logger
from pybenutils.os_operations.mac_input_control import mouse_drag
from pybenutils.os_operations.mac_application_control import ApplicationControl

logger = get_logger()


def handle_user_notification_center(*args):
    """Clicks OK on the UserNotificationCenter popup"""
    logger.info('Initiating handle_user_notification_center')
    user_notification_window = ApplicationControl('UserNotificationCenter')
    approve_button_titles = ["OK"]
    # approve_button_titles = ["OK", "Ignore"]
    if user_notification_window.is_running():
        for title in approve_button_titles:
            if user_notification_window.click_by_title(title, timeout=2):
                logger.info(
                    'Button {bttn} was pressed on UserNotificationCenter'.
                    format(bttn=title))


def handle_security_agent(user_password, *args):
    """Approves the security agent popup requesting the active user's administrator password"""
    logger.info('Initiating handle_security_agent')
    security_agent_window = ApplicationControl('SecurityAgent')
    approve_button_titles = ["OK", "Modify Configuration"]
    if security_agent_window.is_running():
示例#2
0
 def test_successful_import(self):
     logger = get_logger()
     logger.info('Logger import working correctly')
     logger.debug(logger.name)
     self.assertTrue(True)