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

re-enable download unit tests

This commit is contained in:
Mike Fährmann 2017-10-25 12:55:36 +02:00
parent 963670d73b
commit 27c026543f
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 8 additions and 4 deletions

View File

@ -264,7 +264,7 @@ class TestJob(DownloadJob):
def __exit__(self, *args):
pass
def open(self):
def open(self, mode):
self.size = 0
return self
@ -276,6 +276,9 @@ class TestJob(DownloadJob):
def tell(self):
return self.size
def part_size(self):
return 0
def __init__(self, url, parent=None, content=False):
DownloadJob.__init__(self, url, parent)
self.content = content

View File

@ -22,6 +22,7 @@ class TestExtractors(unittest.TestCase):
config.set(("extractor", "password"), name)
config.set(("extractor", "nijie", "username"), email)
config.set(("extractor", "seiga", "username"), email)
config.set(("downloader", "part"), False)
def tearDown(self):
config.clear()
@ -35,7 +36,7 @@ class TestExtractors(unittest.TestCase):
else:
content = False
tjob = job.TestJob(url, content=False)
tjob = job.TestJob(url, content=content)
self.assertEqual(extr, tjob.extractor.__class__)
if not result:
@ -49,8 +50,8 @@ class TestExtractors(unittest.TestCase):
self.assertEqual(result["url"], tjob.hash_url.hexdigest())
if "keyword" in result:
self.assertEqual(result["keyword"], tjob.hash_keyword.hexdigest())
# if "content" in result:
# self.assertEqual(result["content"], tjob.hash_content.hexdigest())
if "content" in result:
self.assertEqual(result["content"], tjob.hash_content.hexdigest())
if "count" in result:
self.assertEqual(len(tjob.urllist), int(result["count"]))
if "pattern" in result: