def test_generate_message(): 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" assert m.info == "YY1YY-12 :This is a test message"
def test_generate_missing_message(): m = MessagePacket() m.source = "XX1XX-11" m.destination = "APRS" m.path = "TCPIP*,qAR,T2TEST" m.addressee = "YY1YY-12" with pytest.raises(GenerateError): m.info
def test_invalid_message_addressee_type(): m = MessagePacket() # Addressee must be a str with pytest.raises(TypeError): m.addressee = 123
def test_invalid_message_addressee_value(): m = MessagePacket() # Addressee must be 9 characters or less with pytest.raises(ValueError): m.addressee = "XXX1XXX-11"