aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tests
diff options
context:
space:
mode:
authorgarret <garret@airmail.cc>2024-04-02 08:53:55 +0100
committergarret <garret@airmail.cc>2024-04-02 08:53:55 +0100
commita285500fbcf69cbedf2df5cf028abeba1108ea50 (patch)
tree90acb655fd74bdb289801855bdcca6c86ab2c899 /tests
parent69fff170663d6e2d258edca7503b2e7897227a76 (diff)
downloadyt-dlp-rajiko-a285500fbcf69cbedf2df5cf028abeba1108ea50.tar.gz
yt-dlp-rajiko-a285500fbcf69cbedf2df5cf028abeba1108ea50.tar.bz2
yt-dlp-rajiko-a285500fbcf69cbedf2df5cf028abeba1108ea50.zip
sort out package "building" and metadatav1.0
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_randominfo.py14
-rwxr-xr-xtests/test_tokens.py26
2 files changed, 40 insertions, 0 deletions
diff --git a/tests/test_randominfo.py b/tests/test_randominfo.py
new file mode 100755
index 0000000..bd71fdc
--- /dev/null
+++ b/tests/test_randominfo.py
@@ -0,0 +1,14 @@
+#!/usr/bin/env python3
+import unittest
+
+from yt_dlp_plugins.extractor import radiko
+from yt_dlp import YoutubeDL
+
+
+ie = radiko._RadikoBaseIE()
+ydl = YoutubeDL(auto_init=False)
+ie.set_downloader(ydl)
+
+info = ie._generate_random_info()
+print("random device info")
+print(info)
diff --git a/tests/test_tokens.py b/tests/test_tokens.py
new file mode 100755
index 0000000..ba6475f
--- /dev/null
+++ b/tests/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