예제 #1
0
async def setup_panel(mocker):
    mocker.patch.multiple(
        cfg, LOGGING_LEVEL_CONSOLE=logging.DEBUG, LOGGING_DUMP_PACKETS=True
    )
    mocker.patch("paradox.lib.utils.main_thread_loop", asyncio.get_event_loop())
    # cfg.LOGGING_LEVEL_CONSOLE = logging.DEBUG
    # cfg.LOGGING_DUMP_PACKETS = True

    logger.setLevel(logging.DEBUG)
    alarm = Paradox()
    # alarm.work_loop.set_debug(True)

    alarm.run_state = RunState.RUN

    start_communication_response = Container(
        fields=Container(value=Container(product_id="MAGELLAN_MG5050"))
    )

    alarm.panel = create_panel(alarm, start_communication_response)

    await send_initial_status(alarm)
    con = MockConnection(alarm.on_connection_message)

    alarm._connection = con
    alarm._register_connection_handlers()

    return alarm, con
예제 #2
0
async def setup_panel(mocker):
    mocker.patch.object(cfg, "LOGGING_LEVEL_CONSOLE", logging.DEBUG)
    mocker.patch.object(cfg, "LOGGING_DUMP_PACKETS", True)
    mocker.patch("paradox.lib.utils.main_thread_loop", asyncio.get_event_loop())
    # cfg.LOGGING_LEVEL_CONSOLE = logging.DEBUG
    # cfg.LOGGING_DUMP_PACKETS = True
    
    logger.setLevel(logging.DEBUG)
    alarm = Paradox()
    #alarm.work_loop.set_debug(True)

    alarm.run_state = RunState.RUN
    alarm.panel = create_panel(alarm, 'MAGELLAN_MG5050')
    
    await send_initial_status(alarm)
    con = MockConnection(alarm.on_connection_message)
    
    alarm._connection = con
    alarm._register_connection_handlers()
    
    return alarm, con