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