]> www.average.org Git - loctrkd.git/blobdiff - test/test_ocid_dload.py
test: opencellid downloader
[loctrkd.git] / test / test_ocid_dload.py
diff --git a/test/test_ocid_dload.py b/test/test_ocid_dload.py
new file mode 100644 (file)
index 0000000..0089ce0
--- /dev/null
@@ -0,0 +1,27 @@
+""" Send junk to the collector """
+
+from sqlite3 import connect
+from time import sleep
+from typing import Any
+import unittest
+from .common import send_and_drain, TestWithServers
+from gps303 import ocid_dload
+
+
+class Ocid_Dload(TestWithServers):
+    def setUp(self, *args: str, **kwargs: Any) -> None:
+        super().setUp(httpd=True)
+
+    def tearDown(self) -> None:
+        sleep(1)  # give collector some time
+        super().tearDown()
+
+    def test_ocid_dload(self) -> None:
+        ocid_dload.main(self.conf)
+        with connect(self.conf.get("opencellid", "dbfn")) as db:
+            (count,) = db.execute("select count(*) from cells").fetchone()
+        self.assertEqual(count, 163)
+
+
+if __name__ == "__main__":
+    unittest.main()