]> git.bitcoin.ninja Git - youtube-dl/blob - test/test_verbose_output.py
[sportdeutschland] Update to new sportdeutschland API
[youtube-dl] / test / test_verbose_output.py
1 #!/usr/bin/env python
2 # coding: utf-8
3
4 from __future__ import unicode_literals
5
6 import unittest
7
8 import sys
9 import os
10 import subprocess
11 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
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, '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)
29
30     def test_private_info_shortarg(self):
31         outp = subprocess.Popen(
32             [
33                 sys.executable, 'youtube_dl/__main__.py', '-v',
34                 '-u', 'johnsmith@gmail.com',
35                 '-p', 'secret',
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)
42
43     def test_private_info_eq(self):
44         outp = subprocess.Popen(
45             [
46                 sys.executable, 'youtube_dl/__main__.py', '-v',
47                 '--username=johnsmith@gmail.com',
48                 '--password=secret',
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)
55
56     def test_private_info_shortarg_eq(self):
57         outp = subprocess.Popen(
58             [
59                 sys.executable, 'youtube_dl/__main__.py', '-v',
60                 '-u=johnsmith@gmail.com',
61                 '-p=secret',
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)
68
69
70 if __name__ == '__main__':
71     unittest.main()