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:21:23 UTC
svn commit: r1562286 -
/incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py
Author: joyce
Date: Tue Jan 28 22:21:22 2014
New Revision: 1562286
URL: http://svn.apache.org/r1562286
Log:
CLIMATE-326 - Add failure jsonp time extract.
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=1562286&r1=1562285&r2=1562286&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:21:22 2014
@@ -132,5 +132,25 @@ class TestTimeExtraction(unittest.TestCa
self.assertDictEqual(expected_return, response.json)
+ def test_failure_time_extract_jsonp(self):
+ expected_return = {
+ "success": False,
+ "variables": ["invalid_lon", "invalid_time", "invalid_lat"]
+ }
+
+ file_location = os.path.abspath('tests/example_data/lat_lon_time_invalid.nc')
+
+ response = test_app.get('/lfme/list_time/' + 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")
+
if __name__ == '__main__':
unittest.main()