]>
Raphaƫl G. Git Repositories - youtubedl/blob - test/test_YoutubeDLCookieJar.py
6a8243590d704973e6f77eee0b8b25bdb696654b
4 from __future__
import unicode_literals
11 sys
.path
.insert(0, os
.path
.dirname(os
.path
.dirname(os
.path
.abspath(__file__
))))
13 from youtube_dl
.utils
import YoutubeDLCookieJar
16 class TestYoutubeDLCookieJar(unittest
.TestCase
):
17 def test_keep_session_cookies(self
):
18 cookiejar
= YoutubeDLCookieJar('./test/testdata/cookies/session_cookies.txt')
19 cookiejar
.load(ignore_discard
=True, ignore_expires
=True)
20 tf
= tempfile
.NamedTemporaryFile(delete
=False)
22 cookiejar
.save(filename
=tf
.name
, ignore_discard
=True, ignore_expires
=True)
23 temp
= tf
.read().decode('utf-8')
24 self
.assertTrue(re
.search(
25 r
'www\.foobar\.foobar\s+FALSE\s+/\s+TRUE\s+0\s+YoutubeDLExpiresEmpty\s+YoutubeDLExpiresEmptyValue', temp
))
26 self
.assertTrue(re
.search(
27 r
'www\.foobar\.foobar\s+FALSE\s+/\s+TRUE\s+0\s+YoutubeDLExpires0\s+YoutubeDLExpires0Value', temp
))
33 if __name__
== '__main__':