mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 20:22:36 +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:
parent
6940ad0e72
commit
3fa74ca4d7
@ -87,23 +87,23 @@ class TestExtractorResults(unittest.TestCase):
|
|||||||
def _run_test(self, result):
|
def _run_test(self, result):
|
||||||
result.pop("#comment", None)
|
result.pop("#comment", None)
|
||||||
auth = result.pop("#auth", 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:
|
if auth is None:
|
||||||
auth = (result["#category"][1] in AUTH)
|
auth = (result["#category"][1] in AUTH)
|
||||||
elif not auth:
|
elif not auth:
|
||||||
|
# auth explicitly disabled
|
||||||
for key in AUTH_CONFIG:
|
for key in AUTH_CONFIG:
|
||||||
config.set((), key, None)
|
config.set((), key, None)
|
||||||
|
|
||||||
if auth:
|
if auth and not any(extr.config(key) for key in AUTH_CONFIG):
|
||||||
extr = result["#class"].from_url(result["#url"])
|
return self._skipped.append((result["#url"], "no auth"))
|
||||||
if not any(extr.config(key) for key in AUTH_CONFIG):
|
|
||||||
self._skipped.append((result["#url"], "no auth"))
|
|
||||||
only_matching = True
|
|
||||||
|
|
||||||
if only_matching:
|
|
||||||
content = False
|
|
||||||
else:
|
|
||||||
if "#options" in result:
|
if "#options" in result:
|
||||||
for key, value in result["#options"].items():
|
for key, value in result["#options"].items():
|
||||||
key = key.split(".")
|
key = key.split(".")
|
||||||
@ -111,13 +111,8 @@ class TestExtractorResults(unittest.TestCase):
|
|||||||
if "#range" in result:
|
if "#range" in result:
|
||||||
config.set((), "image-range" , result["#range"])
|
config.set((), "image-range" , result["#range"])
|
||||||
config.set((), "chapter-range", result["#range"])
|
config.set((), "chapter-range", result["#range"])
|
||||||
content = ("#sha1_content" in result)
|
|
||||||
|
|
||||||
tjob = ResultJob(result["#url"], content=content)
|
tjob = ResultJob(extr, content=("#sha1_content" in result))
|
||||||
self.assertEqual(result["#class"], tjob.extractor.__class__, "#class")
|
|
||||||
|
|
||||||
if only_matching:
|
|
||||||
return
|
|
||||||
|
|
||||||
if "#exception" in result:
|
if "#exception" in result:
|
||||||
with self.assertRaises(result["#exception"], msg="#exception"):
|
with self.assertRaises(result["#exception"], msg="#exception"):
|
||||||
|
Loading…
Reference in New Issue
Block a user