You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
809 B

8 years ago
  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()