diff --git a/DEV.md b/DEV.md index 0936bcd..3478c7c 100644 --- a/DEV.md +++ b/DEV.md @@ -9,4 +9,11 @@ ## Testing + # basic PYTHONPATH=. pytest + + # debug messages enabled + DEBUG=true PYTHONPATH=. pytest + + # output to stderr activated + DEBUG=true PYTHONPATH=. pytest -rP diff --git a/tests/BackendTests.py b/tests/BackendTests.py new file mode 100644 index 0000000..cb8f3c8 --- /dev/null +++ b/tests/BackendTests.py @@ -0,0 +1,40 @@ +import sys +import unittest +from datetime import datetime as ddatetime +from pprint import pprint + +from web.run import retrieve_amda_netcdf + + +class BaseTestCase(unittest.TestCase): + def setUp(self): + # initialise app + # self.app = create_app(TestConfig) + + # update flask context + # self.app_context = self.app.app_context() + # self.app_context.push() + pass + + def tearDown(self): + # if os.path.isfile(self.db_path): + # os.remove(self.db_path) + # self.app_context.pop() + pass + + def test_always_true(self): + self.assertTrue(True) + + +class AmdaTestCase(BaseTestCase): + + def test_amda_retrieve(self): + FILE_DATE_FMT = "%Y-%m-%d %H:%M:%S" + started_at = ddatetime.strptime("2021-12-17 00:00:00", FILE_DATE_FMT) + stopped_at = ddatetime.strptime("2021-12-18 00:00:00", FILE_DATE_FMT) + amda_list = retrieve_amda_netcdf("earth", "omni_hour_all", started_at, stopped_at) + self.assertEqual(1, len(amda_list)) + self.assertIn('amda-irap-omp-eu-ddservice-base-data-omni-hour-omni202107010-nc', amda_list[0]) + + def test_projects(self): + self.assertTrue(False) -- libgit2 0.21.2