aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2026-01-06 04:24:52 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2026-01-06 04:24:52 -0500
commit385e4bfb1e426d23417ac788a6f44d639e226c89 (patch)
treee64f04e19d63014d48e3b5272ce112c637236ba7 /test
parenta24ec1647aeac35a63b744ea856011ad6e06be3b (diff)
New upstream version 1.31.2.upstream/1.31.2upstream
Diffstat (limited to 'test')
-rw-r--r--test/test_downloader.py2
-rw-r--r--test/test_results.py19
2 files changed, 18 insertions, 3 deletions
diff --git a/test/test_downloader.py b/test/test_downloader.py
index fb442c4..920d465 100644
--- a/test/test_downloader.py
+++ b/test/test_downloader.py
@@ -395,6 +395,8 @@ SAMPLES = {
("mp3" , b"\xFF\xFB"),
("mp3" , b"\xFF\xF3"),
("mp3" , b"\xFF\xF2"),
+ ("aac" , b"\xFF\xF9"),
+ ("aac" , b"\xFF\xF1"),
("m3u8", b"#EXTM3U\n#EXT-X-STREAM-INF:PROGRAM-ID=1, BANDWIDTH=200000"),
("mpd" , b'<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"'),
("zip" , b"PK\x03\x04"),
diff --git a/test/test_results.py b/test/test_results.py
index 0865686..55b8844 100644
--- a/test/test_results.py
+++ b/test/test_results.py
@@ -56,14 +56,14 @@ AUTH_REQUIRED = {
"poipiku",
}
-AUTH_KEYS = (
+AUTH_KEYS = {
"username",
"cookies",
"api-key",
"client-id",
"access-token",
"refresh-token",
-)
+}
class TestExtractorResults(unittest.TestCase):
@@ -145,7 +145,7 @@ class TestExtractorResults(unittest.TestCase):
for key in AUTH_KEYS:
config.set((), key, None)
- if auth and not any(extr.config(key) for key in AUTH_KEYS):
+ if auth and not self._has_auth(extr, auth):
self._skipped.append((result["#url"], "no auth"))
self.skipTest("no auth")
@@ -271,6 +271,19 @@ class TestExtractorResults(unittest.TestCase):
for kwdict in kwdicts:
self._test_kwdict(kwdict, metadata)
+ def _has_auth(self, extr, auth):
+ if auth is True:
+ auth = AUTH_KEYS
+
+ if isinstance(auth, str):
+ return extr.config(auth)
+ if isinstance(auth, set):
+ return any(self._has_auth(extr, a) for a in auth)
+ if isinstance(auth, (tuple, list)):
+ return all(self._has_auth(extr, k) for k in auth)
+
+ self.fail(f"Invalid '#auth' value: {auth!r}")
+
def _test_kwdict(self, kwdict, tests, parent=None):
for key, test in tests.items():