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