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

Add commented out test for jsonp status code

parent 0d8e7c55
Branches
No related tags found
No related merge requests found
...@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment