2025-04-01 22:10:00 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from ogn.parser.aprs_comment.microtrak_parser import MicrotrakParser
|
|
|
|
|
|
|
|
|
|
|
|
class TestStringMethods(unittest.TestCase):
|
|
|
|
def test_position_comment(self):
|
|
|
|
message = MicrotrakParser().parse_position("id21A8CBA8")
|
|
|
|
|
2025-04-23 08:32:54 +00:00
|
|
|
assert message['address_type'] == 1
|
|
|
|
assert message['aircraft_type'] == 8
|
2025-04-01 22:10:00 +00:00
|
|
|
self.assertFalse(message['stealth'])
|
|
|
|
self.assertFalse(message['no-tracking'])
|
2025-04-23 08:32:54 +00:00
|
|
|
assert message['address'] == "A8CBA8"
|
2025-04-01 22:10:00 +00:00
|
|
|
|
|
|
|
def test_position_comment_relevant_keys_only(self):
|
|
|
|
# return only keys where we got informations
|
|
|
|
message = MicrotrakParser().parse_position("id21A8CBA8")
|
|
|
|
|
|
|
|
self.assertIsNotNone(message)
|
2025-04-23 08:32:54 +00:00
|
|
|
assert sorted(message.keys()) == sorted(['address_type', 'aircraft_type', 'stealth', 'address', 'no-tracking'])
|
2025-04-01 22:10:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|