aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_YoutubeDLCookieJar.py
diff options
context:
space:
mode:
authorbashonly <bashonly@bashonly.com>2023-07-15 15:22:10 -0500
committerbashonly <bashonly@bashonly.com>2023-07-15 15:25:45 -0500
commit6c5211cebeacfc53ad5d5ddf4a659be76039656f (patch)
tree94c09b4fae723e5aceade4797ead6876827d0e6d /test/test_YoutubeDLCookieJar.py
parent2b029ca0a9f9105c4f7626993fa60e54c9782749 (diff)
downloadhypervideo-pre-6c5211cebeacfc53ad5d5ddf4a659be76039656f.tar.lz
hypervideo-pre-6c5211cebeacfc53ad5d5ddf4a659be76039656f.tar.xz
hypervideo-pre-6c5211cebeacfc53ad5d5ddf4a659be76039656f.zip
[core] Fix HTTP headers and cookie handling
- Remove `Cookie` header from `http_headers` immediately after loading into cookiejar - Restore compat for `--load-info-json` cookies - Add more tests - Fix improper passing of Cookie header by `MailRu` extractor Closes #7558 Authored by: bashonly, pukkandan
Diffstat (limited to 'test/test_YoutubeDLCookieJar.py')
-rw-r--r--test/test_YoutubeDLCookieJar.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/test_YoutubeDLCookieJar.py b/test/test_YoutubeDLCookieJar.py
index 2c73d7d85..0b7a0acdb 100644
--- a/test/test_YoutubeDLCookieJar.py
+++ b/test/test_YoutubeDLCookieJar.py
@@ -53,6 +53,14 @@ class TestYoutubeDLCookieJar(unittest.TestCase):
header = cookiejar.get_cookie_header('https://www.foobar.foobar')
self.assertIn('HTTPONLY_COOKIE', header)
+ def test_get_cookies_for_url(self):
+ cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/session_cookies.txt')
+ cookiejar.load(ignore_discard=True, ignore_expires=True)
+ cookies = cookiejar.get_cookies_for_url('https://www.foobar.foobar/')
+ self.assertEqual(len(cookies), 2)
+ cookies = cookiejar.get_cookies_for_url('https://foobar.foobar/')
+ self.assertFalse(cookies)
+
if __name__ == '__main__':
unittest.main()