async def test_handle_panel_event(mocker): interface = BasicMQTTInterface() interface.mqtt = mocker.MagicMock() event = Event() event.label = "Test" event.minor = 0 event.major = 0 event.time = datetime.datetime(2019, 10, 18, 17, 15) interface._handle_panel_event(event) interface.mqtt.publish.assert_called_once_with( 'paradox/events/raw', json.dumps( { "additional_data": {}, "change": {}, "key": "None,Test,", "label": "Test", "level": "NOTSET", "major": 0, "message": "", "minor": 0, "tags": [], "time": "2019-10-18T17:15:00", "timestamp": 0, "type": None }, sort_keys=True), 0, True)
async def test_handle_panel_event(mocker): interface = get_interface(mocker) try: await asyncio.sleep(0.01) event = Event() event.label = "Test" event.minor = 0 event.major = 0 event.time = datetime.datetime(2019, 10, 18, 17, 15) interface._handle_panel_event(event) await asyncio.sleep(0.01) interface.mqtt.publish.assert_called_once_with('paradox/events/raw', json.dumps({"additional_data": {}, "change": {}, "key": "None,Test,", "label": "Test", "level": "NOTSET", "major": 0, "message": "", "minor": 0, "tags": [], "time": "2019-10-18T17:15:00", "timestamp": 0, "type": None}, sort_keys=True), 0, True) finally: interface.stop() interface.join() assert not interface.is_alive()