From 6044e58773f28e674b15356e804f8e98af46f5c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Gru=CC=88ndger?= Date: Thu, 28 Sep 2017 22:30:06 +0200 Subject: [PATCH] Tests for OGFLR, OGNTRK and OGNSDR --- ogn/parser/parse.py | 6 +++++- tests/parser/test_parse.py | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ogn/parser/parse.py b/ogn/parser/parse.py index a2348de..474ff56 100644 --- a/ogn/parser/parse.py +++ b/ogn/parser/parse.py @@ -140,7 +140,7 @@ def parse_ogn_beacon(aprs_comment, dstcall="APRS"): return rc_data raise OgnParseError(aprs_comment) - elif dstcall == "OGNFLR": + elif dstcall == "OGFLR": ac_data = parse_ogn_aircraft_beacon(aprs_comment) ac_data.update({'beacon_type': 'aircraft_beacon'}) return ac_data @@ -148,6 +148,10 @@ def parse_ogn_beacon(aprs_comment, dstcall="APRS"): ac_data = parse_ogn_aircraft_beacon(aprs_comment) ac_data.update({'beacon_type': 'aircraft_beacon'}) return ac_data + elif dstcall == "OGNSDR": + ac_data = parse_ogn_receiver_beacon(aprs_comment) + ac_data.update({'beacon_type': 'receiver_beacon'}) + return ac_data elif dstcall == "OGLT24": ac_data = parse_lt24_beacon(aprs_comment) ac_data.update({'beacon_type': 'lt24_beacon'}) diff --git a/tests/parser/test_parse.py b/tests/parser/test_parse.py index 1c151a7..b855baa 100644 --- a/tests/parser/test_parse.py +++ b/tests/parser/test_parse.py @@ -26,6 +26,15 @@ class TestStringMethods(unittest.TestCase): def test_aprs_receiver_beacons(self): self.parse_valid_beacon_data_file(filename='aprs_receiver.txt', beacon_type='receiver_beacon') + def test_ogn_flarm_beacons(self): + self.parse_valid_beacon_data_file(filename='ogn_flarm.txt', beacon_type='aircraft_beacon') + + def test_ogn_receiver_beacons(self): + self.parse_valid_beacon_data_file(filename='ogn_receiver.txt', beacon_type='receiver_beacon') + + def test_ogn_tracker_beacons(self): + self.parse_valid_beacon_data_file(filename='ogn_tracker.txt', beacon_type='aircraft_beacon') + def test_lt24_beacons(self): self.parse_valid_beacon_data_file(filename='lt24.txt', beacon_type='lt24_beacon')