diff --git a/gallery_dl/job.py b/gallery_dl/job.py index 902288f1..ae946ac9 100644 --- a/gallery_dl/job.py +++ b/gallery_dl/job.py @@ -344,8 +344,10 @@ class TestJob(DownloadJob): self.content = content self.list_url = [] self.list_keyword = [] + self.list_archive = [] self.hash_url = hashlib.sha1() self.hash_keyword = hashlib.sha1() + self.hash_archive = hashlib.sha1() self.hash_content = hashlib.sha1() if content: self.fileobj = self.HashIO(self.hash_content) @@ -358,6 +360,7 @@ class TestJob(DownloadJob): def handle_url(self, url, keywords): self.update_url(url) self.update_keyword(keywords) + self.update_archive(keywords) self.update_content(url) def handle_urllist(self, urls, keywords): @@ -382,6 +385,12 @@ class TestJob(DownloadJob): self.hash_keyword.update( json.dumps(kwdict, sort_keys=True).encode()) + def update_archive(self, kwdict): + """Update the archive-id hash""" + archive_id = self.extractor.archive_fmt.format_map(kwdict) + self.list_archive.append(archive_id) + self.hash_archive.update(archive_id.encode()) + def update_content(self, url): """Update the content hash""" if self.content: diff --git a/test/test_extractors.py b/test/test_extractors.py index 67a9d04a..1da4cf0a 100644 --- a/test/test_extractors.py +++ b/test/test_extractors.py @@ -68,6 +68,10 @@ class TestExtractors(unittest.TestCase): pass raise + # test archive-id uniqueness + self.assertEqual(len(set(tjob.list_archive)), len(tjob.list_archive)) + + # test extraction results if "url" in result: self.assertEqual(result["url"], tjob.hash_url.hexdigest())