示例#1
0
 def test_load_cookies(self):
     dirname, filename = os.path.split(os.path.abspath(__file__))
     cookies = dirname + '/example_cookies.txt'
     session_cookies = YouTubeTranscriptApi._load_cookies(
         cookies, 'GJLlxj_dtq8')
     self.assertEqual({'TEST_FIELD': 'TEST_VALUE'},
                      requests.utils.dict_from_cookiejar(session_cookies))
示例#2
0
 def test_load_cookies__no_valid_cookies(self):
     dirname, filename = os.path.split(os.path.abspath(__file__))
     expired_cookies = dirname + '/expired_example_cookies.txt'
     with self.assertRaises(CookiesInvalid):
         YouTubeTranscriptApi._load_cookies(expired_cookies, 'GJLlxj_dtq8')
示例#3
0
 def test_load_cookies__bad_file_path(self):
     bad_cookies = 'nonexistent_cookies.txt'
     with self.assertRaises(CookiePathInvalid):
         YouTubeTranscriptApi._load_cookies(bad_cookies, 'GJLlxj_dtq8')