예제 #1
0
파일: test_aprs.py 프로젝트: tarpn/aioax25
def test_send_response_oneshot():
    """
    Test that send_response ignores one-shot messages.
    """
    ax25int = DummyAX25Interface()
    aprsint = APRSInterface(ax25int, 'VK4MSL-10')
    aprsint.send_response(
        APRSMessageFrame(destination='VK4BWI-2',
                         source='VK4MSL-10',
                         addressee='VK4BWI-2',
                         message=b'testing',
                         msgid=None))

    # Nothing should be sent
    eq_(len(ax25int.transmitted), 0)
예제 #2
0
파일: test_aprs.py 프로젝트: tarpn/aioax25
def test_send_response_rej():
    """
    Test that send_response with ack=False sends rejection.
    """
    ax25int = DummyAX25Interface()
    aprsint = APRSInterface(ax25int, 'VK4MSL-10')
    aprsint.send_response(APRSMessageFrame(destination='VK4BWI-2',
                                           source='VK4MSL-10',
                                           addressee='VK4BWI-2',
                                           message=b'testing',
                                           msgid=123),
                          ack=False)

    # The APRS message handler will have tried sending the message
    eq_(len(ax25int.transmitted), 1)
    frame = ax25int.transmitted.pop(0)

    # Frame is a APRS message rejection frame
    assert isinstance(frame, APRSMessageFrame)
    eq_(frame.payload, b':VK4MSL-10:rej123')