Release 2024.07.02
[yt-dlp.git] / test / test_iqiyi_sdk_interpreter.py
blob4e41007c821197dbab02d70d4692f505ac1dee84
1 #!/usr/bin/env python3
3 # Allow direct execution
4 import os
5 import sys
6 import unittest
8 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
11 from test.helper import FakeYDL, is_download_test
12 from yt_dlp.extractor import IqiyiIE
15 class WarningLogger:
16 def __init__(self):
17 self.messages = []
19 def warning(self, msg):
20 self.messages.append(msg)
22 def debug(self, msg):
23 pass
25 def error(self, msg):
26 pass
29 @is_download_test
30 class TestIqiyiSDKInterpreter(unittest.TestCase):
31 def test_iqiyi_sdk_interpreter(self):
32 """
33 Test the functionality of IqiyiSDKInterpreter by trying to log in
35 If `sign` is incorrect, /validate call throws an HTTP 556 error
36 """
37 logger = WarningLogger()
38 ie = IqiyiIE(FakeYDL({'logger': logger}))
39 ie._perform_login('foo', 'bar')
40 self.assertTrue('unable to log in:' in logger.messages[0])
43 if __name__ == '__main__':
44 unittest.main()