def test_rx_selftodigi_downlink(): """ Test the digipeater module digipeats when own call is first. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface) interface.received_msg.emit( interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=[ 'VK2RXX', # Ordinarily, this should have the H bit set! 'VK4RZA*', 'VK4MSL-10', 'VK4RZB' ], pid=0xff, payload=b'testing')) # This should have been digipeated eq_(len(interface.transmitted), 1) frame = interface.transmitted.pop() # It should be passed through VK4MSL-10. H bits of prior repeaters # should be left intact. eq_(str(frame.header.repeaters), 'VK2RXX,VK4RZA*,VK4MSL-10*,VK4RZB')
def test_disconnect(): """ Test the digipeater module stops digipeating when disconnected. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface) interface.received_msg.emit(interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=['VK4MSL-10', 'VK4RZB'], pid=0xff, payload=b'testing')) # This should have been digipeated eq_(len(interface.transmitted), 1) frame = interface.transmitted.pop() # It should be passed through VK4MSL-10. eq_(str(frame.header.repeaters), 'VK4MSL-10*,VK4RZB') # Disconnect, then send another message digipeater.disconnect(interface) interface.received_msg.emit(interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=['VK4MSL-10', 'VK4RZB'], pid=0xff, payload=b'testing 2')) # This should not have been digipeated eq_(len(interface.transmitted), 0)
def test_rx_selftodigi_alias(): """ Test the digipeater module digipeats when alias is first. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.addaliases('GATE') digipeater.connect(interface) interface.received_msg.emit( interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=[ 'GATE', 'VK4RZB' ], pid=0xff, payload=b'testing' ) ) # This should have been digipeated eq_(len(interface.transmitted), 1) frame = interface.transmitted.pop() # It should be passed through VK4MSL-10. eq_(str(frame.header.repeaters), 'VK4MSL-10*,VK4RZB')
def test_connect_noadd(): """ Test we can connect an interface without adding its call to our "mydigi" list. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface, addcall=False) eq_(digipeater._mydigi, set())
def test_disconnect_norm(): """ Test we can disconnect an interface without removing its call from our "mydigi" list. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface) digipeater.disconnect(interface, rmcall=False) eq_(digipeater._mydigi, set([AX25Address.decode('VK4MSL-10')]))
def test_rx_irrelevant(): """ Test the digipeater module ignores irrelevant frames. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface) interface.received_msg.emit(interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=['VK4RZA', 'VK4RZB'], pid=0xff, payload=b'testing')) # This should have been dropped eq_(len(interface.transmitted), 0)
def test_rx_hybridpath(): """ Test the digipeater module handles typical APRS paths. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface) interface.received_msg.emit(interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=['WIDE1-1', 'WIDE2-2'], pid=0xff, payload=b'testing')) # This should have been digipeated eq_(len(interface.transmitted), 1) frame = interface.transmitted.pop() eq_(str(frame.header.repeaters), 'VK4MSL-10*,WIDE2-2')
def test_rx_nexthop(): """ Test the digipeater module appends the correct WIDEn-N next hop. """ interface = DummyAPRSInterface() digipeater = APRSDigipeater() digipeater.connect(interface) interface.received_msg.emit(interface=interface, frame=AX25UnnumberedInformationFrame( destination='VK4MSL-1', source='VK4MSL-2', repeaters=['WIDE3-3'], pid=0xff, payload=b'testing')) # This should have been digipeated eq_(len(interface.transmitted), 1) frame = interface.transmitted.pop() eq_(str(frame.header.repeaters), 'VK4MSL-10*,WIDE3-2')