climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1562335 - /incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py
Date Wed, 29 Jan 2014 00:48:56 GMT
Author: joyce
Date: Wed Jan 29 00:48:56 2014
New Revision: 1562335

URL: http://svn.apache.org/r1562335
Log:
CLIMATE-326 - Add successful jsonp variable extract 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=1562335&r1=1562334&r2=1562335&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 Wed
Jan 29 00:48:56 2014
@@ -165,6 +165,26 @@ class TestVariableExtraction(unittest.Te
 
         self.assertDictEqual(expected_return, response.json)
 
+    def test_successful_variable_extract_jsonp(self):
+        expected_return = {
+            'success': True,
+            'variables': ['lat', 'lon', 'time']
+        }
+
+        file_location = os.path.abspath('tests/example_data/lat_lon_time.nc')
+
+        response = test_app.get('/lfme/list_vars/' + 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_variable_extract(self):
         expected_return = {'success': False}
 



Mime
View raw message