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

make test-parameters optional

This commit is contained in:
Mike Fährmann 2015-12-13 03:56:29 +01:00
parent 9c9b1e112a
commit 0961ece989
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -8,12 +8,12 @@
# published by the Free Software Foundation.
import unittest
import gallery_dl.extractor as extractor
import gallery_dl.jobs as jobs
from gallery_dl import extractor, jobs, config
class TestExttractors(unittest.TestCase):
def test_extractors(self):
config.load()
for extr in extractor.extractors():
if not hasattr(extr, "test"):
continue
@ -25,8 +25,10 @@ class TestExttractors(unittest.TestCase):
def run_test(self, url, result):
hjob = jobs.HashJob(url)
hjob.run()
self.assertEqual(hjob.hash_url.hexdigest(), result["url"])
self.assertEqual(hjob.hash_keyword.hexdigest(), result["keyword"])
if "url" in result:
self.assertEqual(hjob.hash_url.hexdigest(), result["url"])
if "keyword" in result:
self.assertEqual(hjob.hash_keyword.hexdigest(), result["keyword"])
if __name__ == '__main__':
unittest.main(warnings='ignore')