aboutsummaryrefslogtreecommitdiff
path: root/test/test_utils.py
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2017-05-26 21:58:18 +0800
committerYen Chi Hsuan <yan12125@gmail.com>2017-05-26 21:58:18 +0800
commit5552c9eb0fece567f7dda13810939fca32d7d65a (patch)
treef3bde11319d42fbe7013dc1326c83ad799c39892 /test/test_utils.py
parent59ed87cbd9ea08c889514a05b646141004f432a1 (diff)
[utils] Recognize more patterns in strip_jsonp()
Used in Youku Show pages
Diffstat (limited to 'test/test_utils.py')
-rw-r--r--test/test_utils.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index f31559e71..d7e05817c 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -678,6 +678,14 @@ class TestUtil(unittest.TestCase):
d = json.loads(stripped)
self.assertEqual(d, {'status': 'success'})
+ stripped = strip_jsonp('window.cb && window.cb({"status": "success"});')
+ d = json.loads(stripped)
+ self.assertEqual(d, {'status': 'success'})
+
+ stripped = strip_jsonp('window.cb && cb({"status": "success"});')
+ d = json.loads(stripped)
+ self.assertEqual(d, {'status': 'success'})
+
def test_uppercase_escape(self):
self.assertEqual(uppercase_escape('aä'), 'aä')
self.assertEqual(uppercase_escape('\\U0001d550'), '𝕐')