diff --git a/lambda/sonde_api_to_iot_core/__init__.py b/lambda/sonde_api_to_iot_core/__init__.py index d5ed63a..15f4228 100644 --- a/lambda/sonde_api_to_iot_core/__init__.py +++ b/lambda/sonde_api_to_iot_core/__init__.py @@ -312,8 +312,8 @@ def telemetry_filter(telemetry): return (False, f"dxlAPRS-SHUE versions below 1.1.2 due not send correct serial numbers for M10 radiosondes. Please update to 1.1.2 or later") if "DFM" in telemetry["type"]: if telemetry["software_name"] == "SondeMonitor": - if parse_sondemonitor_version(telemetry["software_version"]) < (6,2,8,7): - return (False,f"SondeMonitor version is out of date and doesn't handle DFM radiosondes correctly. Please update to 6.2.8.7 or later") + if parse_sondemonitor_version(telemetry["software_version"]) < (6,2,8,8): + return (False,f"SondeMonitor version is out of date and doesn't handle DFM radiosondes correctly. Please update to 6.2.8.8 or later") if telemetry["software_name"] == "rdzTTGOsonde": ttgo_branch, ttgo_version = parse_rdz_ttgo_version(telemetry["software_version"]) if ttgo_branch == "devel": diff --git a/lambda/sonde_api_to_iot_core/__main__.py b/lambda/sonde_api_to_iot_core/__main__.py index b96bbd7..54da285 100644 --- a/lambda/sonde_api_to_iot_core/__main__.py +++ b/lambda/sonde_api_to_iot_core/__main__.py @@ -181,7 +181,26 @@ class TestIngestion(unittest.TestCase): sns.publish.assert_not_called() body_decode = json.loads(output["body"]) self.assertEqual(body_decode["message"], "some or all payloads could not be processed") - + def test_good_sondemonitor_payload(self): + payload = copy.deepcopy(example_body) + payload[0]["datetime"] = datetime.datetime.now().isoformat() + payload[0]["software_name"] = "SondeMonitor" + payload[0]["software_version"] = "6.2.8.8" + payload[0]["type"] = "DFM" + output = lambda_handler(compress_payload(payload), fakeContext()) + sns.publish.assert_called() + self.assertEqual(output["body"], "^v^ telm logged") + self.assertEqual(output["statusCode"], 200) + def test_bad_sondemonitor_payload(self): + payload = copy.deepcopy(example_body) + payload[0]["datetime"] = datetime.datetime.now().isoformat() + payload[0]["software_name"] = "SondeMonitor" + payload[0]["software_version"] = "6.2.8.7" + payload[0]["type"] = "DFM" + output = lambda_handler(compress_payload(payload), fakeContext()) + sns.publish.assert_not_called() + body_decode = json.loads(output["body"]) + self.assertEqual(body_decode["message"], "some or all payloads could not be processed") if __name__ == '__main__': unittest.main() \ No newline at end of file