]>
jfr.im git - yt-dlp.git/blob - test/test_verbose_output.py
7 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
9 rootDir
= os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
)))
12 class TestVerboseOutput(unittest
.TestCase
):
13 def test_private_info_arg(self
):
14 outp
= subprocess
.Popen(
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
)
27 def test_private_info_shortarg(self
):
28 outp
= subprocess
.Popen(
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
)
41 def test_private_info_eq(self
):
42 outp
= subprocess
.Popen(
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
)
55 def test_private_info_shortarg_eq(self
):
56 outp
= subprocess
.Popen(
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
)
70 if __name__
== '__main__':