|
|
@ -14,6 +14,9 @@ from youtube_dl.utils import YoutubeDLCookieJar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestYoutubeDLCookieJar(unittest.TestCase):
|
|
|
|
class TestYoutubeDLCookieJar(unittest.TestCase):
|
|
|
|
|
|
|
|
def __assert_cookie_has_value(self, cookiejar, key):
|
|
|
|
|
|
|
|
self.assertEqual(cookiejar._cookies['www.foobar.foobar']['/'][key].value, key + '_VALUE')
|
|
|
|
|
|
|
|
|
|
|
|
def test_keep_session_cookies(self):
|
|
|
|
def test_keep_session_cookies(self):
|
|
|
|
cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/session_cookies.txt')
|
|
|
|
cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/session_cookies.txt')
|
|
|
|
cookiejar.load(ignore_discard=True, ignore_expires=True)
|
|
|
|
cookiejar.load(ignore_discard=True, ignore_expires=True)
|
|
|
@ -32,12 +35,13 @@ class TestYoutubeDLCookieJar(unittest.TestCase):
|
|
|
|
def test_strip_httponly_prefix(self):
|
|
|
|
def test_strip_httponly_prefix(self):
|
|
|
|
cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/httponly_cookies.txt')
|
|
|
|
cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/httponly_cookies.txt')
|
|
|
|
cookiejar.load(ignore_discard=True, ignore_expires=True)
|
|
|
|
cookiejar.load(ignore_discard=True, ignore_expires=True)
|
|
|
|
|
|
|
|
self.__assert_cookie_has_value(cookiejar, 'HTTPONLY_COOKIE')
|
|
|
|
|
|
|
|
self.__assert_cookie_has_value(cookiejar, 'JS_ACCESSIBLE_COOKIE')
|
|
|
|
|
|
|
|
|
|
|
|
def assert_cookie_has_value(key):
|
|
|
|
def test_convert_spaces_to_tabs(self):
|
|
|
|
self.assertEqual(cookiejar._cookies['www.foobar.foobar']['/'][key].value, key + '_VALUE')
|
|
|
|
cookiejar = YoutubeDLCookieJar('./test/testdata/cookies/cookie_file_with_spaces.txt')
|
|
|
|
|
|
|
|
cookiejar.load(ignore_discard=True, ignore_expires=True)
|
|
|
|
assert_cookie_has_value('HTTPONLY_COOKIE')
|
|
|
|
self.__assert_cookie_has_value(cookiejar, 'COOKIE')
|
|
|
|
assert_cookie_has_value('JS_ACCESSIBLE_COOKIE')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|