From b5298403470347bfba79130c49bb7dca7ee906d8 Mon Sep 17 00:00:00 2001 From: garret Date: Sun, 11 Aug 2024 11:43:12 +0100 Subject: move misc stuff to "misc" folder the tests arent tests really, probably shouldnt give that impression + maybe now they wont get automatically included in the build --- misc/test-tokens.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 misc/test-tokens.py (limited to 'misc/test-tokens.py') diff --git a/misc/test-tokens.py b/misc/test-tokens.py new file mode 100755 index 0000000..ba6475f --- /dev/null +++ b/misc/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 -- cgit v1.2.3-70-g09d2