예제 #1
0
def test_onMessageReceived(gateway: ZIPGateway):
    connection = DummyConnection()
    msg = Basic.Get()
    gateway._connections = {2: connection}
    gateway.onMessageReceived(connection, Zip.ZipPacket(sourceEP=0,
                                                        command=msg))
    gateway.listener.messageReceived.assert_called_once_with(
        gateway, 2, 0, msg, 0)
예제 #2
0
def test_onMessageReceived_noNode(gateway: ZIPGateway):
    gateway._connections = {2: DummyConnection()}
    gateway.onMessageReceived(DummyConnection(), Basic.Get())
    gateway.listener.messageReceived.assert_not_called()