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