示例#1
0
def test_generate_message_with_message_id():
    m = MessagePacket()
    m.source = "XX1XX-11"
    m.destination = "APRS"
    m.path = "TCPIP*,qAR,T2TEST"
    m.addressee = "YY1YY-12"
    m.message = "This is a test message"
    m.message_id = "001"

    assert m.info == "YY1YY-12 :This is a test message{001"
示例#2
0
def test_invalid_message_id_value():
    m = MessagePacket()

    # Message ID must be 5 characters or less
    with pytest.raises(ValueError):
        m.message_id = "123456"
示例#3
0
def test_invalid_message_id_type():
    m = MessagePacket()

    # Message ID must be a str and 5 characters or less
    with pytest.raises(TypeError):
        m.message_id = 123