From fab9f35fbcb84afe3e8e01f62dc94818fdd9620c Mon Sep 17 00:00:00 2001 From: David Hoese <david.hoese@ssec.wisc.edu> Date: Sun, 26 Feb 2023 13:48:32 -0600 Subject: [PATCH] Fix unit tests for rig -> aoss filenaming change from 4 years ago --- metobsapi/tests/test_files_api.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/metobsapi/tests/test_files_api.py b/metobsapi/tests/test_files_api.py index 105e0c5..0d9f930 100644 --- a/metobsapi/tests/test_files_api.py +++ b/metobsapi/tests/test_files_api.py @@ -56,29 +56,29 @@ class TestFilesAPI(unittest.TestCase): def test_tower_daily_ascii_csv(self): res = self.app.get("/api/files.csv?streams=aoss.tower.ascii.l00.*") - fn = bytes(self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data def test_tower_daily_ascii_json(self): res = self.app.get("/api/files.json?streams=aoss.tower.ascii.l00.*") - fn = bytes(self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data def test_tower_daily_ascii_sh(self): res = self.app.get("/api/files.sh?streams=aoss.tower.ascii.l00.*") - fn = bytes(self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data def test_tower_daily_ascii_bat(self): res = self.app.get("/api/files.bat?streams=aoss.tower.ascii.l00.*") - fn = bytes(self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data def test_tower_daily_ascii_dated_json(self): dt = self._datetimes[1] begin = dt.strftime("%Y-%m-%d") res = self.app.get("/api/files.json?streams=aoss.tower.ascii.l00.*&begin={}".format(begin)) - fn = bytes(dt.strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(dt.strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data def test_tower_daily_ascii_relative_json(self): @@ -92,9 +92,9 @@ class TestFilesAPI(unittest.TestCase): begin = dt.strftime("%Y-%m-%d") res = self.app.get("/api/files.json?streams=aoss.tower.ascii.l00.*&begin=-2&end={}".format(begin)) for dt in self._datetimes[1:]: - fn = bytes(dt.strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(dt.strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data - fn = bytes(self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn not in res.data def test_tower_daily_ascii_both_relative_json(self): @@ -105,29 +105,29 @@ class TestFilesAPI(unittest.TestCase): """ res = self.app.get("/api/files.json?streams=aoss.tower.ascii.l00.*&begin=-2&end=-2") for dt in self._datetimes[2:3]: - fn = bytes(dt.strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(dt.strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data - fn = bytes(self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn not in res.data def test_tower_daily_ascii_relative_noend_json(self): res = self.app.get("/api/files.json?streams=aoss.tower.ascii.l00.*&begin=-2") for dt in self._datetimes: - fn = bytes(dt.strftime("rig_tower.%Y-%m-%d.ascii"), encoding="utf-8") + fn = bytes(dt.strftime("aoss_tower.%Y-%m-%d.ascii"), encoding="utf-8") assert fn in res.data - # fn = bytes(self._datetimes[0].strftime('rig_tower.%Y-%m-%d.ascii'), encoding='utf-8') + # fn = bytes(self._datetimes[0].strftime('aoss_tower.%Y-%m-%d.ascii'), encoding='utf-8') # assert fn not in res.data def test_tower_all_patterns(self): res = self.app.get("/api/files.json?streams=aoss.tower.*.l00.*") res = json.loads(str(res.data, encoding="utf-8")) - fn = self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii") + fn = self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii") assert res["data"][0]["filename"] == fn def test_tower_multi_all_patterns(self): res = self.app.get("/api/files.json?streams=aoss.tower.*.l00.*:aoss.tower.nc-daily.lb1.v00") res = json.loads(str(res.data, encoding="utf-8")) - fn = self._datetimes[0].strftime("rig_tower.%Y-%m-%d.ascii") + fn = self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.ascii") assert res["data"][0]["filename"] == fn fn = self._datetimes[0].strftime("aoss_tower.%Y-%m-%d.nc") assert res["data"][1]["filename"] == fn -- GitLab