]>
Commit | Line | Data |
---|---|---|
cc52de43 | 1 | #!/usr/bin/env python3 |
54007a45 | 2 | |
a4e4d7df YCH |
3 | # Allow direct execution |
4 | import os | |
5 | import sys | |
6 | import unittest | |
f8271158 | 7 | |
a4e4d7df YCH |
8 | sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
9 | ||
f8271158 | 10 | |
54007a45 | 11 | from test.helper import FakeYDL, is_download_test |
7a5c1cfe | 12 | from yt_dlp.extractor import IqiyiIE |
a4e4d7df YCH |
13 | |
14 | ||
86e5f3ed | 15 | class WarningLogger: |
a4e4d7df YCH |
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 | ||
060ac762 | 29 | @is_download_test |
a4e4d7df YCH |
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() | |
52efa4b3 | 38 | ie = IqiyiIE(FakeYDL({'logger': logger})) |
39 | ie._perform_login('foo', 'bar') | |
a4e4d7df YCH |
40 | self.assertTrue('unable to log in:' in logger.messages[0]) |
41 | ||
582be358 | 42 | |
a4e4d7df YCH |
43 | if __name__ == '__main__': |
44 | unittest.main() |