climate-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject svn commit: r1562285 - /incubator/climate/trunk/ocw-ui/backend/tests/test_local_file_metadata_extractors.py
Date Tue, 28 Jan 2014 22:21:17 GMT
Author: joyce
Date: Tue Jan 28 22:21:17 2014
New Revision: 1562285

URL: http://svn.apache.org/r1562285
Log:
CLIMATE-326 - Add successful jsonp time 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=1562285&r1=1562284&r2=1562285&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:17 2014
@@ -98,6 +98,28 @@ class TestTimeExtraction(unittest.TestCa
 
         self.assertDictEqual(expected_return, response.json)
 
+	def test_successful_time_extract_jsonp(self):
+		expected_return = {
+			"success": True,
+			"time_name": "time",
+			"start_time": "1988-06-10 00:00:00",
+			"end_time": "2008-01-27 00:00:00"
+		}
+
+        file_location = os.path.abspath('tests/example_data/lat_lon_time.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")
+
     def test_failure_time_extract(self):
         expected_return = {
             "success": False,



Mime
View raw message