test_netrc.py 710 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env python3
  2. # Allow direct execution
  3. import os
  4. import sys
  5. import unittest
  6. sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
  7. from yt_dlp.extractor import gen_extractor_classes
  8. from yt_dlp.extractor.common import InfoExtractor
  9. NO_LOGIN = InfoExtractor._perform_login
  10. class TestNetRc(unittest.TestCase):
  11. def test_netrc_present(self):
  12. for ie in gen_extractor_classes():
  13. if ie._perform_login is NO_LOGIN:
  14. continue
  15. self.assertTrue(
  16. ie._NETRC_MACHINE,
  17. f'Extractor {ie.IE_NAME} supports login, but is missing a _NETRC_MACHINE property')
  18. if __name__ == '__main__':
  19. unittest.main()