[imagefap] update unit tests

old gallery/image has been deleted
This commit is contained in:
Mike Fährmann 2017-10-26 15:27:42 +02:00
parent caf26412dd
commit 035ef655f1
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
4 changed files with 15 additions and 12 deletions

View File

@ -172,7 +172,8 @@ class FlickrGroupExtractor(FlickrExtractor):
directory_fmt = ["{category}", "{subcategory}s", "{group[groupname]}"]
pattern = [r"(?:https?://)?(?:www\.)?flickr\.com/groups/([^/]+)"]
test = [("https://www.flickr.com/groups/bird_headshots/", {
"url": "1ac6b088abdc723ec17e951a1f77d8923620737a",
"pattern": (r"https?://farm\d+\.staticflickr\.com"
r"/\d+/\d+_[0-9a-f]+(_[a-z])?\.[a-z]+"),
})]
def data(self):

View File

@ -22,15 +22,16 @@ class ImagefapGalleryExtractor(Extractor):
pattern = [(r"(?:https?://)?(?:www\.)?imagefap\.com/"
r"(?:gallery\.php\?gid=|gallery/|pictures/)(\d+)")]
test = [
("http://www.imagefap.com/gallery/6318447", {
"url": "f63e6876df83a40e1a98dad70e46952dd9edb7a7",
"keyword": "275857d113bb007245de705ae7bd0dff7d677874",
"content": "38e50699db9518ae68648c45ecdd6be614efc324",
("http://www.imagefap.com/pictures/7102714", {
"url": "ffb1d58924fc9d6a0650006a96395a04454b85cf",
"keyword": "b65c310d75269cb6dcc32c3fc1bdcf39bea45342",
"content": "694a0a57385980a6f90fbc296cadcd6c11ba2dab",
}),
("http://www.imagefap.com/gallery/5486966", {
"url": "eace9b33be99f87f3382c87bd915cf495a865d6e",
"keyword": "b84da0543c2d1f848bf5e4c2950dd4f4543a1e0c",
}),
("http://www.imagefap.com/gallery.php?gid=7102714", None),
]
def __init__(self, match):
@ -86,10 +87,9 @@ class ImagefapImageExtractor(Extractor):
directory_fmt = ["{category}", "{gallery_id} {title}"]
filename_fmt = "{category}_{gallery_id}_{name}.{extension}"
pattern = [r"(?:https?://)?(?:www\.)?imagefap\.com/photo/(\d+)"]
test = [("http://www.imagefap.com/photo/1616331218/", {
"url": "8a05c0ccdcf84e63c962803bc41d247628c549ea",
"keyword": "c5023841c72b88949786c231f472f51453103185",
"content": "964b8c62c9d5c2a039a2fccf1b1e10aaf7a18a96",
test = [("http://www.imagefap.com/photo/1369341772/", {
"url": "24cc4312e4a5084f39f1e35af5ba92e5f7c1ad3c",
"keyword": "26ae84575067b8231878ec1a2d1e14a0fbcea865",
})]
def __init__(self, match):

View File

@ -10,7 +10,7 @@
"""Create testdata for extractor tests"""
import argparse
from gallery_dl import job, config, extractor
from gallery_dl import job, config, extractor
TESTDATA_FMT = """
test = [("{}", {{
@ -26,6 +26,7 @@ TESTDATA_EXCEPTION_FMT = """
}})]
"""
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--content", action="store_true")
@ -43,6 +44,7 @@ def main():
urls = args.urls
config.load()
config.set(("downloader", "part"), False)
for url in urls:
tjob = job.TestJob(url, content=args.content)
try:
@ -58,5 +60,6 @@ def main():
print(tjob.extractor.__class__.__name__)
print(fmt.format(url, *data))
if __name__ == '__main__':
main()

View File

@ -74,8 +74,7 @@ skip = [
"archivedmoe", "archiveofsins", "thebarchive",
# temporary issues
"imgtrex",
"imagefap",
"flickr",
"loveisover", # certificate verify failed
]
# enable selective testing for direct calls
if __name__ == '__main__' and len(sys.argv) > 1: