aboutsummaryrefslogtreecommitdiff
path: root/test/test_YoutubeDLCookieJar.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2020-05-05 04:19:33 +0700
committerSergey M․ <dstftw@gmail.com>2020-05-05 04:21:25 +0700
commitc380cc28c4e94b4b61db7f86d35e48197b407266 (patch)
tree39b6f7fcf913ea8ef4775ea1d54fe86793e32539 /test/test_YoutubeDLCookieJar.py
parentf7f304910d1c1fc19313231d424daba304e1de71 (diff)
downloadyoutube-dl-c380cc28c4e94b4b61db7f86d35e48197b407266.tar.xz
[utils] Improve cookie files support
+ Add support for UTF-8 in cookie files * Skip malformed cookie file entries instead of crashing (invalid entry len, invalid expires at)
Diffstat (limited to 'test/test_YoutubeDLCookieJar.py')
-rw-r--r--test/test_YoutubeDLCookieJar.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_YoutubeDLCookieJar.py b/test/test_YoutubeDLCookieJar.py
index f959798de..05f48bd74 100644
--- a/test/test_YoutubeDLCookieJar.py
+++ b/test/test_YoutubeDLCookieJar.py
@@ -39,6 +39,13 @@ class TestYoutubeDLCookieJar(unittest.TestCase):
assert_cookie_has_value('HTTPONLY_COOKIE')
assert_cookie_has_value('JS_ACCESSIBLE_COOKIE')
+ def test_malformed_cookies(self):
+ cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/malformed_cookies.txt')
+ cookiejar.load(ignore_discard=True, ignore_expires=True)
+ # Cookies should be empty since all malformed cookie file entries
+ # will be ignored
+ self.assertFalse(cookiejar._cookies)
+
if __name__ == '__main__':
unittest.main()