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