]> jfr.im git - yt-dlp.git/blob - test/test_verbose_output.py
[ie/TubiTv] Fix extractor (#9975)
[yt-dlp.git] / test / test_verbose_output.py
1 #!/usr/bin/env python3
2
3 # Allow direct execution
4 import os
5 import sys
6 import unittest
7
8 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
9
10
11 import subprocess
12
13 rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
14
15
16 class TestVerboseOutput(unittest.TestCase):
17 def test_private_info_arg(self):
18 outp = subprocess.Popen(
19 [
20 sys.executable, 'yt_dlp/__main__.py',
21 '-v', '--ignore-config',
22 '--username', 'johnsmith@gmail.com',
23 '--password', 'my_secret_password',
24 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
25 sout, serr = outp.communicate()
26 self.assertTrue(b'--username' in serr)
27 self.assertTrue(b'johnsmith' not in serr)
28 self.assertTrue(b'--password' in serr)
29 self.assertTrue(b'my_secret_password' not in serr)
30
31 def test_private_info_shortarg(self):
32 outp = subprocess.Popen(
33 [
34 sys.executable, 'yt_dlp/__main__.py',
35 '-v', '--ignore-config',
36 '-u', 'johnsmith@gmail.com',
37 '-p', 'my_secret_password',
38 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
39 sout, serr = outp.communicate()
40 self.assertTrue(b'-u' in serr)
41 self.assertTrue(b'johnsmith' not in serr)
42 self.assertTrue(b'-p' in serr)
43 self.assertTrue(b'my_secret_password' not in serr)
44
45 def test_private_info_eq(self):
46 outp = subprocess.Popen(
47 [
48 sys.executable, 'yt_dlp/__main__.py',
49 '-v', '--ignore-config',
50 '--username=johnsmith@gmail.com',
51 '--password=my_secret_password',
52 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
53 sout, serr = outp.communicate()
54 self.assertTrue(b'--username' in serr)
55 self.assertTrue(b'johnsmith' not in serr)
56 self.assertTrue(b'--password' in serr)
57 self.assertTrue(b'my_secret_password' not in serr)
58
59 def test_private_info_shortarg_eq(self):
60 outp = subprocess.Popen(
61 [
62 sys.executable, 'yt_dlp/__main__.py',
63 '-v', '--ignore-config',
64 '-u=johnsmith@gmail.com',
65 '-p=my_secret_password',
66 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
67 sout, serr = outp.communicate()
68 self.assertTrue(b'-u' in serr)
69 self.assertTrue(b'johnsmith' not in serr)
70 self.assertTrue(b'-p' in serr)
71 self.assertTrue(b'my_secret_password' not in serr)
72
73
74 if __name__ == '__main__':
75 unittest.main()