]> jfr.im git - yt-dlp.git/blame - test/test_verbose_output.py
[niconico] Rewrite NiconicoIE (#3018)
[yt-dlp.git] / test / test_verbose_output.py
CommitLineData
cc52de43 1#!/usr/bin/env python3
ce28252c
PH
2# coding: utf-8
3
4from __future__ import unicode_literals
5
6import unittest
7
8import sys
9import os
10import subprocess
11sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
12
13rootDir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
14
15
16class TestVerboseOutput(unittest.TestCase):
17 def test_private_info_arg(self):
18 outp = subprocess.Popen(
19 [
7a5c1cfe 20 sys.executable, 'yt_dlp/__main__.py', '-v',
ce28252c 21 '--username', 'johnsmith@gmail.com',
f95a7b93 22 '--password', 'my_secret_password',
ce28252c
PH
23 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
24 sout, serr = outp.communicate()
52aa7e74
YCH
25 self.assertTrue(b'--username' in serr)
26 self.assertTrue(b'johnsmith' not in serr)
27 self.assertTrue(b'--password' in serr)
f95a7b93 28 self.assertTrue(b'my_secret_password' not in serr)
ce28252c
PH
29
30 def test_private_info_shortarg(self):
31 outp = subprocess.Popen(
32 [
7a5c1cfe 33 sys.executable, 'yt_dlp/__main__.py', '-v',
ce28252c 34 '-u', 'johnsmith@gmail.com',
f95a7b93 35 '-p', 'my_secret_password',
ce28252c
PH
36 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
37 sout, serr = outp.communicate()
52aa7e74
YCH
38 self.assertTrue(b'-u' in serr)
39 self.assertTrue(b'johnsmith' not in serr)
40 self.assertTrue(b'-p' in serr)
f95a7b93 41 self.assertTrue(b'my_secret_password' not in serr)
ce28252c
PH
42
43 def test_private_info_eq(self):
44 outp = subprocess.Popen(
45 [
7a5c1cfe 46 sys.executable, 'yt_dlp/__main__.py', '-v',
ce28252c 47 '--username=johnsmith@gmail.com',
f95a7b93 48 '--password=my_secret_password',
ce28252c
PH
49 ], cwd=rootDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
50 sout, serr = outp.communicate()
52aa7e74
YCH
51 self.assertTrue(b'--username' in serr)
52 self.assertTrue(b'johnsmith' not in serr)
53 self.assertTrue(b'--password' in serr)
f95a7b93 54 self.assertTrue(b'my_secret_password' not in serr)
ce28252c
PH
55
56 def test_private_info_shortarg_eq(self):
57 outp = subprocess.Popen(
58 [
7a5c1cfe 59 sys.executable, 'yt_dlp/__main__.py', '-v',
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()