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

[tests] allow checking for exact URL results

This commit is contained in:
Mike Fährmann 2023-09-23 19:26:54 +02:00
parent 642998504d
commit dbd820d7c5
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 28 additions and 0 deletions

View File

@ -16,6 +16,7 @@ __tests__ = (
"#class" : imgur.ImgurImageExtractor, "#class" : imgur.ImgurImageExtractor,
"#sha1_url" : "6f2dcfb86815bdd72808c313e5f715610bc7b9b2", "#sha1_url" : "6f2dcfb86815bdd72808c313e5f715610bc7b9b2",
"#sha1_content": "0c8768055e4e20e7c7259608b67799171b691140", "#sha1_content": "0c8768055e4e20e7c7259608b67799171b691140",
"#urls" : "https://i.imgur.com/21yMxCS.png",
"account_id" : 0, "account_id" : 0,
"comment_count" : int, "comment_count" : int,
@ -159,6 +160,27 @@ __tests__ = (
"#category": ("", "imgur", "album"), "#category": ("", "imgur", "album"),
"#class" : imgur.ImgurAlbumExtractor, "#class" : imgur.ImgurAlbumExtractor,
"#sha1_url": "ce3552f550a5b5316bd9c7ae02e21e39f30c0563", "#sha1_url": "ce3552f550a5b5316bd9c7ae02e21e39f30c0563",
"#urls" : (
"https://i.imgur.com/693j2Kr.jpg",
"https://i.imgur.com/ZNalkAC.jpg",
"https://i.imgur.com/lMox9Ek.jpg",
"https://i.imgur.com/6PryGOv.jpg",
"https://i.imgur.com/ecasnH2.jpg",
"https://i.imgur.com/NlJDmFG.jpg",
"https://i.imgur.com/aCwKs8S.jpg",
"https://i.imgur.com/Oz4rpxo.jpg",
"https://i.imgur.com/hE93Xsn.jpg",
"https://i.imgur.com/A5uBLSx.jpg",
"https://i.imgur.com/zZghWiD.jpg",
"https://i.imgur.com/ALV4fYV.jpg",
"https://i.imgur.com/FDd90t9.jpg",
"https://i.imgur.com/Txw37NO.jpg",
"https://i.imgur.com/DcLw7Cl.jpg",
"https://i.imgur.com/a4VChy8.jpg",
"https://i.imgur.com/auCwCig.jpg",
"https://i.imgur.com/Z8VihIb.jpg",
"https://i.imgur.com/6WDRFne.jpg",
),
"album" : { "album" : {
"account_id" : 0, "account_id" : 0,

View File

@ -151,6 +151,12 @@ class TestExtractorResults(unittest.TestCase):
for url in tjob.url_list: for url in tjob.url_list:
self.assertRegex(url, result["#pattern"]) self.assertRegex(url, result["#pattern"])
if "#urls" in result:
expected = result["#urls"]
if isinstance(expected, str):
expected = (expected,)
self.assertSequenceEqual(tjob.url_list, expected)
metadata = {k: v for k, v in result.items() if k[0] != "#"} metadata = {k: v for k, v in result.items() if k[0] != "#"}
if metadata: if metadata:
for kwdict in tjob.kwdict_list: for kwdict in tjob.kwdict_list: