aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test_tokens.py
blob: ba6475fd366cf0c65e8a1054fb71515d1e8e6d48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python3
import unittest

from yt_dlp_plugins.extractor import radiko
from yt_dlp import YoutubeDL


class test_tokens(unittest.TestCase):

	def setUp(self):
		self.ie = radiko._RadikoBaseIE()
		ydl = YoutubeDL(auto_init=False)
		self.ie.set_downloader(ydl)

	def test_area(self):
		# check areas etc work
		for i in range(1, 48):
			area = "JP" + str(i)
			with self.subTest(f"Negotiating token for {area}", area=area):
				token = self.ie._negotiate_token(area)
				self.assertEqual(token.get("X-Radiko-AreaId"), area)


if __name__ == '__main__':
	unittest.main()
	# may wish to set failfast=True