]> jfr.im git - yt-dlp.git/blobdiff - test/test_YoutubeDLCookieJar.py
[cookies] Move `YoutubeDLCookieJar` to cookies module (#7091)
[yt-dlp.git] / test / test_YoutubeDLCookieJar.py
index 6280e1f2cbfabc679162d6d1a5039b818b05cc64..2c73d7d85341a2733d9e1ba3a8f3a53d100344ec 100644 (file)
@@ -1,13 +1,17 @@
 #!/usr/bin/env python3
+
+# Allow direct execution
 import os
-import re
 import sys
-import tempfile
 import unittest
 
 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
-from yt_dlp.utils import YoutubeDLCookieJar
+
+import re
+import tempfile
+
+from yt_dlp.cookies import YoutubeDLCookieJar
 
 
 class TestYoutubeDLCookieJar(unittest.TestCase):
@@ -43,6 +47,12 @@ def test_malformed_cookies(self):
         # will be ignored
         self.assertFalse(cookiejar._cookies)
 
+    def test_get_cookie_header(self):
+        cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/httponly_cookies.txt')
+        cookiejar.load(ignore_discard=True, ignore_expires=True)
+        header = cookiejar.get_cookie_header('https://www.foobar.foobar')
+        self.assertIn('HTTPONLY_COOKIE', header)
+
 
 if __name__ == '__main__':
     unittest.main()