allow multiple hashes for content tests

This commit is contained in:
Mike Fährmann
2020-01-15 23:46:37 +01:00
parent f498a9057f
commit 174117f827
2 changed files with 9 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Mike Fährmann
# Copyright 2019-2020 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -41,7 +41,8 @@ class SlickpicAlbumExtractor(SlickpicExtractor):
}),
("https://mattcrandall.slickpic.com/albums/LamborghiniMurcielago/", {
"range": "34",
"content": "cec6630e659dc72db1ee1a9a6f3b525189261988",
"content": ("cec6630e659dc72db1ee1a9a6f3b525189261988",
"6f81e1e74c6cd6db36844e7211eef8e7cd30055d"),
}),
)

View File

@@ -109,7 +109,12 @@ class TestExtractorResults(unittest.TestCase):
self.assertEqual(result["url"], tjob.url_hash.hexdigest())
if "content" in result:
self.assertEqual(result["content"], tjob.content_hash.hexdigest())
expected = result["content"]
digest = tjob.content_hash.hexdigest()
if isinstance(expected, str):
self.assertEqual(digest, expected, "content")
else: # assume iterable
self.assertIn(digest, expected, "content")
if "keyword" in result:
expected = result["keyword"]