aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2023-10-25 13:45:45 +0100
committergarret <garret@airmail.cc>2023-10-25 13:45:45 +0100
commitd75085663ff6638a9b3587c1abba5636fddfbdb8 (patch)
tree2ed1e963eebe35fcff158e2af5958ac29e4a94e8
parent840f19748f1c640bf5e8447d2c5a487347c2cdd3 (diff)
downloadyt-dlp-rajiko-d75085663ff6638a9b3587c1abba5636fddfbdb8.tar.gz
yt-dlp-rajiko-d75085663ff6638a9b3587c1abba5636fddfbdb8.tar.bz2
yt-dlp-rajiko-d75085663ff6638a9b3587c1abba5636fddfbdb8.zip
add token negotiation tests
-rwxr-xr-xtest_tokens.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/test_tokens.py b/test_tokens.py
new file mode 100755
index 0000000..ba6475f
--- /dev/null
+++ b/test_tokens.py
@@ -0,0 +1,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