Commit fe6e8f9bfc1ba5930bc05522a35637cab68bec3e

Authored by hitier
1 parent 1fd5c7a5
Exists in rhitier-dev and in 1 other branch DEV

First test runs

Showing 2 changed files with 47 additions and 0 deletions   Show diff stats
DEV.md
... ... @@ -9,4 +9,11 @@
9 9  
10 10 ## Testing
11 11  
  12 + # basic
12 13 PYTHONPATH=. pytest
  14 +
  15 + # debug messages enabled
  16 + DEBUG=true PYTHONPATH=. pytest
  17 +
  18 + # output to stderr activated
  19 + DEBUG=true PYTHONPATH=. pytest -rP
... ...
tests/BackendTests.py 0 → 100644
... ... @@ -0,0 +1,40 @@
  1 +import sys
  2 +import unittest
  3 +from datetime import datetime as ddatetime
  4 +from pprint import pprint
  5 +
  6 +from web.run import retrieve_amda_netcdf
  7 +
  8 +
  9 +class BaseTestCase(unittest.TestCase):
  10 + def setUp(self):
  11 + # initialise app
  12 + # self.app = create_app(TestConfig)
  13 +
  14 + # update flask context
  15 + # self.app_context = self.app.app_context()
  16 + # self.app_context.push()
  17 + pass
  18 +
  19 + def tearDown(self):
  20 + # if os.path.isfile(self.db_path):
  21 + # os.remove(self.db_path)
  22 + # self.app_context.pop()
  23 + pass
  24 +
  25 + def test_always_true(self):
  26 + self.assertTrue(True)
  27 +
  28 +
  29 +class AmdaTestCase(BaseTestCase):
  30 +
  31 + def test_amda_retrieve(self):
  32 + FILE_DATE_FMT = "%Y-%m-%d %H:%M:%S"
  33 + started_at = ddatetime.strptime("2021-12-17 00:00:00", FILE_DATE_FMT)
  34 + stopped_at = ddatetime.strptime("2021-12-18 00:00:00", FILE_DATE_FMT)
  35 + amda_list = retrieve_amda_netcdf("earth", "omni_hour_all", started_at, stopped_at)
  36 + self.assertEqual(1, len(amda_list))
  37 + self.assertIn('amda-irap-omp-eu-ddservice-base-data-omni-hour-omni202107010-nc', amda_list[0])
  38 +
  39 + def test_projects(self):
  40 + self.assertTrue(False)
... ...