]> jfr.im git - yt-dlp.git/blame - test/test_iqiyi_sdk_interpreter.py
[ie/mlbtv] Fix extraction (#10296)
[yt-dlp.git] / test / test_iqiyi_sdk_interpreter.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
54007a45 2
a4e4d7df
YCH
3# Allow direct execution
4import os
5import sys
6import unittest
f8271158 7
a4e4d7df
YCH
8sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
9
f8271158 10
54007a45 11from test.helper import FakeYDL, is_download_test
7a5c1cfe 12from yt_dlp.extractor import IqiyiIE
a4e4d7df
YCH
13
14
86e5f3ed 15class 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
30class TestIqiyiSDKInterpreter(unittest.TestCase):
31 def test_iqiyi_sdk_interpreter(self):
add96eb9 32 """
a4e4d7df
YCH
33 Test the functionality of IqiyiSDKInterpreter by trying to log in
34
35 If `sign` is incorrect, /validate call throws an HTTP 556 error
add96eb9 36 """
a4e4d7df 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
43if __name__ == '__main__':
44 unittest.main()