3 from __future__ import unicode_literals
5 # Allow direct execution
9 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
11 from test.helper import FakeYDL
12 from youtube_dl.extractor import IqiyiIE
15 class IqiyiIEWithCredentials(IqiyiIE):
16 def _get_login_info(self):
20 class WarningLogger(object):
24 def warning(self, msg):
25 self.messages.append(msg)
34 class TestIqiyiSDKInterpreter(unittest.TestCase):
35 def test_iqiyi_sdk_interpreter(self):
37 Test the functionality of IqiyiSDKInterpreter by trying to log in
39 If `sign` is incorrect, /validate call throws an HTTP 556 error
41 logger = WarningLogger()
42 ie = IqiyiIEWithCredentials(FakeYDL({'logger': logger}))
44 self.assertTrue('unable to log in:' in logger.messages[0])
47 if __name__ == '__main__':