Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MetObsAPI
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
MetObsAPI
Commits
fab9f35f
Verified
Commit
fab9f35f
authored
2 years ago
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
metobsapi/tests/test_files_api.py
+13
-13
13 additions, 13 deletions
metobsapi/tests/test_files_api.py
with
13 additions
and
13 deletions
metobsapi/tests/test_files_api.py
+
13
−
13
View file @
fab9f35f
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment