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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MetObs
MetObsAPI
Commits
815c93be
Verified
Commit
815c93be
authored
Apr 17, 2019
by
David Hoese
Browse files
Options
Downloads
Patches
Plain Diff
Add commented out test for jsonp status code
parent
0d8e7c55
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
metobsapi/tests/test_data_api.py
+10
-12
10 additions, 12 deletions
metobsapi/tests/test_data_api.py
with
10 additions
and
12 deletions
metobsapi/tests/test_data_api.py
+
10
−
12
View file @
815c93be
...
@@ -261,15 +261,13 @@ class TestDataAPI(unittest.TestCase):
...
@@ -261,15 +261,13 @@ class TestDataAPI(unittest.TestCase):
self
.
assertEqual
(
len
(
lines
[
5
].
split
(
'
,
'
)),
1
)
self
.
assertEqual
(
len
(
lines
[
5
].
split
(
'
,
'
)),
1
)
self
.
assertIn
(
"
# code: 400
"
,
res
)
self
.
assertIn
(
"
# code: 400
"
,
res
)
@mock.patch
(
'
metobsapi.data_api.query
'
)
# @mock.patch('metobsapi.data_api.query')
def
test_shorthand_one_symbol_json_column_repeat
(
self
,
query_func
):
# def test_jsonp_bad_symbol_400(self, query_func):
"""
Test that if a channel is repeated in the query it still produces valid data.
"""
# XXX: Not currently possible with flask-json
r
=
fake_data
(
'
1m
'
,
{(
'
aoss
'
,
'
tower
'
):
[
'
time
'
,
'
air_temp
'
]},
9
)
# r = fake_data('1m', {('aoss', 'tower'): ['time', 'air_temp']}, 9)
query_func
.
return_value
=
r
# query_func.return_value = r
res
=
self
.
app
.
get
(
'
/api/data.json?site=aoss&inst=tower&symbols=air_temp&begin=-00:10:00&order=column
'
)
# # row should be the default
res
=
json
.
loads
(
res
.
data
.
decode
())
# res = self.app.get('/api/data.json?site=aoss&inst=tower&symbols=bad&begin=-00:10:00&callback=test')
self
.
assertEqual
(
res
[
'
code
'
],
200
)
# self.assertEqual(res.status_code, 400)
self
.
assertEqual
(
res
[
'
num_results
'
],
9
)
# res = res.data.decode()
self
.
assertIn
(
'
air_temp
'
,
res
[
'
results
'
][
'
data
'
])
# self.assertEqual(res['code'], 400)
self
.
assertEqual
(
len
(
res
[
'
results
'
][
'
data
'
][
'
air_temp
'
]),
9
)
self
.
assertEqual
(
len
(
res
[
'
results
'
][
'
timestamps
'
]),
9
)
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
sign in
to comment