From 29e704996eb9c3ff44dd2f84f42a75b59f0cfa96 Mon Sep 17 00:00:00 2001 From: Mark Jessop Date: Fri, 15 Sep 2023 13:26:25 +0930 Subject: [PATCH] Tweak tests so landing notifications work --- auto_rx/autorx/email_notification.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/auto_rx/autorx/email_notification.py b/auto_rx/autorx/email_notification.py index 6e66b4b..26309fb 100644 --- a/auto_rx/autorx/email_notification.py +++ b/auto_rx/autorx/email_notification.py @@ -117,6 +117,8 @@ class EmailNotification(object): """ Process a new telemmetry dict, and send an e-mail if it is a new sonde. """ _id = telemetry["id"] + print(telemetry) + if _id not in self.sondes: self.sondes[_id] = { "last_time": time.time(), @@ -495,10 +497,10 @@ if __name__ == "__main__": _test = { "id": "N1234557", - "frame": 10, + "frame": 11, "lat": -10.01, "lon": 10.01, - "alt": 800, + "alt": 1100, "temp": 1.0, "type": "RS41", "freq": "401.520 MHz", @@ -510,11 +512,14 @@ if __name__ == "__main__": } print("Testing landing alert.") - for i in range(20): - _email_notification.add(_test) - _test["alt"] = _test["alt"] - 5.0 + for i in range(30): + _tosubmit = _test.copy() + _email_notification.add(_tosubmit) + _test["alt"] = _test["alt"] - 10.0 + _test["lat"] = _test["lat"] + 0.001 + _test["lon"] = _test["lon"] + 0.001 _test["datetime_dt"] = datetime.datetime.utcnow() - time.sleep(2) + time.sleep(1) time.sleep(60)