Skip to content
Snippets Groups Projects
Verified Commit fab9f35f authored by David Hoese's avatar David Hoese
Browse files

Fix unit tests for rig -> aoss filenaming change from 4 years ago

parent 181f8a46
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment