Beispiel #1
0
def test_packet_properties():
    packet = GenericPacket()
    station = Station(callsign="XX1XX-11")
    dest = Station(callsign="APRS")
    path = Path(path="TCPIP*,qAR,T2TEST")

    packet.source = station
    assert packet.source == station

    packet.destination = dest
    assert packet.destination == dest

    packet.path = path
    assert packet.path == path
Beispiel #2
0
def test_station_with_combined_callsign_and_ssid():
    s = Station(callsign="XX1XX-10")

    assert s.callsign == "XX1XX"
    assert s.ssid == 10
    assert str(s) == "XX1XX-10"
    assert repr(s) == "<Station: XX1XX-10>"
Beispiel #3
0
def test_station_with_numeric_sid_zero():
    s = Station(callsign="XX1XX", ssid=0)

    assert s.callsign == "XX1XX"
    assert s.ssid == None
    assert str(s) == "XX1XX"
    assert repr(s) == "<Station: XX1XX>"

    # Test AX.25 validity
    assert s.is_valid_ax25 is True
Beispiel #4
0
def test_station_with_ssid():
    s = Station(callsign="XX1XX", ssid=11)

    assert s.callsign == "XX1XX"
    assert s.ssid == 11
    assert str(s) == "XX1XX-11"
    assert repr(s) == "<Station: XX1XX-11>"

    # Test AX.25 validity
    assert s.is_valid_ax25 is True
Beispiel #5
0
def test_station_with_numeric_sid_over_15():
    s = Station(callsign="XX1XX", ssid="16")

    assert s.callsign == "XX1XX"
    assert s.ssid == "16"
    assert str(s) == "XX1XX-16"
    assert repr(s) == "<Station: XX1XX-16>"

    # Test AX.25 validity
    assert s.is_valid_ax25 is False
Beispiel #6
0
def test_station_with_alpha_ssid():
    s = Station(callsign="XX1XX", ssid="ZZ")

    assert s.callsign == "XX1XX"
    assert s.ssid == "ZZ"
    assert str(s) == "XX1XX-ZZ"
    assert repr(s) == "<Station: XX1XX-ZZ>"

    # Test AX.25 validity
    assert s.is_valid_ax25 is False
Beispiel #7
0
def test_station_with_numeric_ssid_15():
    s = Station(callsign="XX1XX", ssid="15")

    assert s.callsign == "XX1XX"
    assert s.ssid == 15
    assert str(s) == "XX1XX-15"
    assert repr(s) == "<Station: XX1XX-15>"

    # Test AX.25 validity
    assert s.is_valid_ax25 is True
Beispiel #8
0
def test_station_without_ssid():
    s = Station(callsign="XX1XX")

    assert s.callsign == "XX1XX"
    assert s.ssid is None
    assert str(s) == "XX1XX"
    assert repr(s) == "<Station: XX1XX>"

    # Test AX.25 validity
    assert s.is_valid_ax25 is True
Beispiel #9
0
def test_station_with_oversize_callsign():
    s = Station(callsign="XX1XXXX")

    assert s.is_valid_ax25 is False
Beispiel #10
0
def test_invalid_station_ssid_int_value():
    with pytest.raises(ValueError):
        Station(callsign="XX1XX", ssid=16)
Beispiel #11
0
def test_invalid_station_ssid_type():
    with pytest.raises(TypeError):
        Station(callsign="XX1XX", ssid=False)
Beispiel #12
0
def test_invalid_station_callsign_value():
    with pytest.raises(ValueError):
        Station(callsign="XX1_X")
Beispiel #13
0
def test_invalid_station_callsign_type():
    with pytest.raises(TypeError):
        Station(callsign=1)