[ie/dropbox] Fix password-protected video extraction (#11636)
[yt-dlp3.git] / test / test_verbose_output.py
blob21ce10a1fbf345de3b13e327115d2681507a3bfa
1 #!/usr/bin/env python3
3 # Allow direct execution
4 import os
5 import sys
6 import unittest
8 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
11 import subprocess
13 rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
16 class TestVerboseOutput(unittest.TestCase):
17 def test_private_info_arg(self):
18 outp = subprocess.Popen(
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)
31 def test_private_info_shortarg(self):
32 outp = subprocess.Popen(
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)
45 def test_private_info_eq(self):
46 outp = subprocess.Popen(
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)
59 def test_private_info_shortarg_eq(self):
60 outp = subprocess.Popen(
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)
74 if __name__ == '__main__':
75 unittest.main()