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