]>
Raphaƫl G. Git Repositories - youtubedl/blob - test/test_verbose_output.py
4 from __future__
import unicode_literals
11 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
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
, 'youtube_dl/__main__.py', '-v',
21 '--username', 'johnsmith@gmail.com',
22 '--password', 'secret',
23 ], cwd
=rootDir
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
)
24 sout
, serr
= outp
.communicate()
25 self
.assertTrue(b
'--username' in serr
)
26 self
.assertTrue(b
'johnsmith' not in serr
)
27 self
.assertTrue(b
'--password' in serr
)
28 self
.assertTrue(b
'secret' not in serr
)
30 def test_private_info_shortarg(self
):
31 outp
= subprocess
.Popen(
33 sys
.executable
, 'youtube_dl/__main__.py', '-v',
34 '-u', 'johnsmith@gmail.com',
36 ], cwd
=rootDir
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
)
37 sout
, serr
= outp
.communicate()
38 self
.assertTrue(b
'-u' in serr
)
39 self
.assertTrue(b
'johnsmith' not in serr
)
40 self
.assertTrue(b
'-p' in serr
)
41 self
.assertTrue(b
'secret' not in serr
)
43 def test_private_info_eq(self
):
44 outp
= subprocess
.Popen(
46 sys
.executable
, 'youtube_dl/__main__.py', '-v',
47 '--username=johnsmith@gmail.com',
49 ], cwd
=rootDir
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
)
50 sout
, serr
= outp
.communicate()
51 self
.assertTrue(b
'--username' in serr
)
52 self
.assertTrue(b
'johnsmith' not in serr
)
53 self
.assertTrue(b
'--password' in serr
)
54 self
.assertTrue(b
'secret' not in serr
)
56 def test_private_info_shortarg_eq(self
):
57 outp
= subprocess
.Popen(
59 sys
.executable
, 'youtube_dl/__main__.py', '-v',
60 '-u=johnsmith@gmail.com',
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
'secret' not in serr
)
70 if __name__
== '__main__':