]> jfr.im git - yt-dlp.git/blame_incremental - test/test_iqiyi_sdk_interpreter.py
[test:download] Raise on network errors (#10283)
[yt-dlp.git] / test / test_iqiyi_sdk_interpreter.py
... / ...
CommitLineData
1#!/usr/bin/env python3
2
3# Allow direct execution
4import os
5import sys
6import unittest
7
8sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
9
10
11from test.helper import FakeYDL, is_download_test
12from yt_dlp.extractor import IqiyiIE
13
14
15class 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
30class 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
43if __name__ == '__main__':
44 unittest.main()