1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 12:12:34 +01:00

[tests] enable test results for external extractors (#5262)

https://github.com/mikf/gallery-dl/issues/5262#issuecomment-2231649983
This commit is contained in:
Mike Fährmann 2024-07-17 22:29:09 +02:00
parent 6940ad0e72
commit 3fa74ca4d7
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -87,23 +87,23 @@ class TestExtractorResults(unittest.TestCase):
def _run_test(self, result):
result.pop("#comment", None)
auth = result.pop("#auth", None)
only_matching = (len(result) <= 3)
extr = result["#class"].from_url(result["#url"])
if not extr:
raise exception.NoExtractorError()
if len(result) <= 3:
return # only matching
if auth is None:
auth = (result["#category"][1] in AUTH)
elif not auth:
# auth explicitly disabled
for key in AUTH_CONFIG:
config.set((), key, None)
if auth:
extr = result["#class"].from_url(result["#url"])
if not any(extr.config(key) for key in AUTH_CONFIG):
self._skipped.append((result["#url"], "no auth"))
only_matching = True
if auth and not any(extr.config(key) for key in AUTH_CONFIG):
return self._skipped.append((result["#url"], "no auth"))
if only_matching:
content = False
else:
if "#options" in result:
for key, value in result["#options"].items():
key = key.split(".")
@ -111,13 +111,8 @@ class TestExtractorResults(unittest.TestCase):
if "#range" in result:
config.set((), "image-range" , result["#range"])
config.set((), "chapter-range", result["#range"])
content = ("#sha1_content" in result)
tjob = ResultJob(result["#url"], content=content)
self.assertEqual(result["#class"], tjob.extractor.__class__, "#class")
if only_matching:
return
tjob = ResultJob(extr, content=("#sha1_content" in result))
if "#exception" in result:
with self.assertRaises(result["#exception"], msg="#exception"):