Add trip history and route replay
Co-authored-by: Copilot <[email protected]>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import unittest
|
||||
|
||||
from modules import app_sql
|
||||
|
||||
|
||||
class TrackingLoggerTest(unittest.TestCase):
|
||||
def test_logs_first_fix(self):
|
||||
self.assertTrue(
|
||||
app_sql.should_log_tracking((45.5, -73.5), None, None, 0)
|
||||
)
|
||||
|
||||
def test_does_not_persist_parked_five_second_samples(self):
|
||||
self.assertFalse(
|
||||
app_sql.should_log_tracking(
|
||||
(45.500001, -73.5), 0, (45.5, -73.5), 5
|
||||
)
|
||||
)
|
||||
|
||||
def test_logs_fresh_obd_motion(self):
|
||||
self.assertTrue(
|
||||
app_sql.should_log_tracking(
|
||||
(45.5, -73.5), 2, (45.5, -73.5), 5
|
||||
)
|
||||
)
|
||||
|
||||
def test_logs_accumulated_gps_motion_without_obd(self):
|
||||
self.assertTrue(
|
||||
app_sql.should_log_tracking(
|
||||
(45.5001, -73.5), None, (45.5, -73.5), 10
|
||||
)
|
||||
)
|
||||
|
||||
def test_logs_stationary_heartbeat_after_one_minute(self):
|
||||
self.assertTrue(
|
||||
app_sql.should_log_tracking(
|
||||
(45.5, -73.5),
|
||||
0,
|
||||
(45.5, -73.5),
|
||||
app_sql.IDLE_LOG_INTERVAL,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user