1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-01 03:22:52 -05:00

[cookies] Move YoutubeDLCookieJar to cookies module (#7091)

Authored by: coletdjnz
This commit is contained in:
coletdjnz
2023-05-27 19:08:19 +12:00
committed by GitHub
parent 08916a49c7
commit b87e01c123
6 changed files with 157 additions and 137 deletions

View File

@ -11,7 +11,7 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import re
import tempfile
from yt_dlp.utils import YoutubeDLCookieJar
from yt_dlp.cookies import YoutubeDLCookieJar
class TestYoutubeDLCookieJar(unittest.TestCase):
@ -47,6 +47,12 @@ class TestYoutubeDLCookieJar(unittest.TestCase):
# 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()