test_options.py 809 B

123456789101112131415161718192021222324252627
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. # Allow direct execution
  4. import os
  5. import sys
  6. import unittest
  7. sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  8. from youtube_dl.options import _hide_login_info
  9. class TestOptions(unittest.TestCase):
  10. def test_hide_login_info(self):
  11. self.assertEqual(_hide_login_info(['-u', 'foo', '-p', 'bar']),
  12. ['-u', 'PRIVATE', '-p', 'PRIVATE'])
  13. self.assertEqual(_hide_login_info(['-u']), ['-u'])
  14. self.assertEqual(_hide_login_info(['-u', 'foo', '-u', 'bar']),
  15. ['-u', 'PRIVATE', '-u', 'PRIVATE'])
  16. self.assertEqual(_hide_login_info(['--username=foo']),
  17. ['--username=PRIVATE'])
  18. if __name__ == '__main__':
  19. unittest.main()