]> jfr.im git - yt-dlp.git/blob - test/test_iqiyi_sdk_interpreter.py
[test:download] Raise on network errors (#10283)
[yt-dlp.git] / test / test_iqiyi_sdk_interpreter.py
1 #!/usr/bin/env python3
2
3 # Allow direct execution
4 import os
5 import sys
6 import unittest
7
8 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
9
10
11 from test.helper import FakeYDL, is_download_test
12 from yt_dlp.extractor import IqiyiIE
13
14
15 class WarningLogger:
16 def __init__(self):
17 self.messages = []
18
19 def warning(self, msg):
20 self.messages.append(msg)
21
22 def debug(self, msg):
23 pass
24
25 def error(self, msg):
26 pass
27
28
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
34
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])
41
42
43 if __name__ == '__main__':
44 unittest.main()