update unit tests

pull/13/head
Mike Fährmann 8 years ago
parent e23e4b1100
commit cf79a47b59
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 Mike Fährmann
# Copyright 2015-2017 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
@ -22,6 +22,7 @@ def request_func(self, *args):
response = self.session.get(*args)
if response.status_code != 200:
_cookiecache.invalidate(self.root)
self.log.debug(response.text)
self.log.info("Solving Cloudflare challenge")
response = solve_challenge(self.session, response)
_cookiecache(self.root, self.session.cookies)

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2014, 2015 Mike Fährmann
# Copyright 2014-2017 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
@ -23,7 +23,7 @@ class DanbooruTagExtractor(DanbooruExtractor, booru.BooruTagExtractor):
pattern = [(r"(?:https?://)?(?:www\.)?danbooru.donmai.us/posts"
r"\?(?:utf8=%E2%9C%93&)?tags=([^&]+)")]
test = [("https://danbooru.donmai.us/posts?tags=bonocho", {
"url": "f94774bcb5169e943efb4d7bb51c47ae786b05f3",
"url": "04f69a187269019f6d0c32dc7685246fe99d536e",
"content": "b196fb9f1668109d7774a0a82efea3ffdda07746",
})]
@ -43,6 +43,6 @@ class DanbooruPostExtractor(DanbooruExtractor, booru.BooruPostExtractor):
subcategory = "post"
pattern = [r"(?:https?://)?(?:www\.)?danbooru.donmai.us/posts/(\d+)"]
test = [("https://danbooru.donmai.us/posts/294929", {
"url": "9caa006a4d9eedbacbe030655ade0d3225399749",
"url": "954a9fec4d507c46e220c9beb4349b303b1f4433",
"content": "5e255713cbf0a8e0801dc423563c34d896bb9229",
})]

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2015 Mike Fährmann
# Copyright 2015-2017 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
@ -34,8 +34,7 @@ class ImgthGalleryExtractor(Extractor):
data = self.get_job_metadata(page)
yield Message.Version, 1
yield Message.Directory, data
for num, url in enumerate(self.get_images(page), 1):
data["num"] = num
for data["num"], url in enumerate(self.get_images(page), 1):
yield Message.Url, url, text.nameext_from_url(url, data)
def get_images(self, page):
@ -43,6 +42,7 @@ class ImgthGalleryExtractor(Extractor):
pnum = 0
while True:
pos = 0
page = text.extract(page, '<ul class="thumbnails">', '</ul>')[0]
while True:
url, pos = text.extract(page, '<img src="', '"', pos)
if not url:

@ -48,7 +48,7 @@ def _generate_test(extr, tcase):
# enable selective testing for direct calls
skip = ["exhentai", "kissmanga", "mangafox", "mangashare", "readcomiconline"]
skip = ["exhentai", "kissmanga", "mangafox", "mangashare", "fallenangels"]
if __name__ == '__main__' and len(sys.argv) > 1:
extractors = [
extr for extr in extractor.extractors()

Loading…
Cancel
Save