You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2014/01/28 23:19:34 UTC
svn commit: r1562267 -
/incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py
Author: joyce
Date: Tue Jan 28 22:19:33 2014
New Revision: 1562267
URL: http://svn.apache.org/r1562267
Log:
CLIMATE-326 - Add successful jsonp request test
Modified:
incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py
Modified: incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py?rev=1562267&r1=1562266&r2=1562267&view=diff
==============================================================================
--- incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py (original)
+++ incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py Tue Jan 28 22:19:33 2014
@@ -1,9 +1,8 @@
import os
+from ast import literal_eval
import unittest
from webtest import TestApp
-import urllib
-
from ..run_webservices import app
test_app = TestApp(app)
@@ -26,6 +25,32 @@ class TestLatLonExtraction(unittest.Test
self.assertDictEqual(expected_return, response.json)
+ def test_successful_latlon_extract_jsonp(self):
+ expected_return = {
+ 'lon_min': -24.639999389648438,
+ 'lat_max': -45.759998321533203,
+ 'success': True,
+ 'lon_name': 'lon',
+ 'lat_name': 'lat',
+ 'lon_max': 60.279998779296875,
+ 'lat_min': -45.759998321533203
+ }
+
+ file_location = os.path.abspath('tests/example_data/lat_lon_time.nc')
+
+ response = test_app.get('/lfme/list_latlon/' + file_location + '?callback=test_callback')
+
+ json = response.text
+
+ # Strip out the callback functino and the json string from the response
+ # and check for proper content.
+ callback = json[:json.index('(')]
+ json = json[json.index('(') + 1 : json.rindex(')')]
+ json = literal_eval(json)
+
+ self.assertDictEqual(expected_return, json)
+ self.assertEqual(callback, "test_callback")
+
def test_failure_latlon_extract(self):
expected_return = {
"success": False,