async def test_handleMessage(node: Node): # Skip handlers, when there is a session wating for the message node.addWaitingSession(Basic.Get) assert await node.handleMessage(Basic.Get(), 0) is True # Try again without any sessions assert await node.handleMessage(Basic.Get(), 0) is False # Send message with handler assert (await node.handleMessage( AssociationGrpInfo.GroupNameReport(groupingsIdentifier=1, name="Lifeline"), 0, ) is True)
async def test_supervision_handled(node: Node): supervision = Supervision.Get(statusUpdates=False, sessionID=42, command=Basic.Report(value=1)) node.addWaitingSession(Basic.Report) assert await node.handleMessage(supervision, 0) is True node._adapter.sendToNode.assert_called_with( node.rootNodeId, Supervision.Report( moreStatusUpdates=False, wakeUpRequest=False, sessionID=supervision.sessionID, status=0xFF, duration=0, ), destEP=0, sourceEP=0, timeout=3, )