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:
parent
963670d73b
commit
27c026543f
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user