mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-25 04:02:32 +01:00
several changes to make travis build work
- fixed html.unescape not being available on Python3.3 - removed inconsistent test result - added username/password pairs for authenticating extractors
This commit is contained in:
parent
cfe5bf732a
commit
00074a71d7
@ -18,7 +18,6 @@ class InfinitychanThreadExtractor(chan.ChanThreadExtractor):
|
||||
test = [("https://8ch.net/wh40k/res/1.html", {
|
||||
"url": "9220c79950d3f9cdd2c0436e816aec6b8342fac1",
|
||||
"keyword": "df5773339c5864c71b63fc26ca60ea7098b83cb1",
|
||||
"content": "0533b95bee50c616e3c1a8c50e4087e170cfd950",
|
||||
})]
|
||||
api_url = "https://8ch.net/{board}/res/{thread}.json"
|
||||
file_url = "https://media.8ch.net/{board}/src/{tim}{ext}"
|
||||
|
@ -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
|
||||
@ -113,4 +113,8 @@ else:
|
||||
|
||||
unquote = urllib.parse.unquote
|
||||
|
||||
unescape = html.unescape
|
||||
try:
|
||||
unescape = html.unescape
|
||||
except AttributeError:
|
||||
import html.parse
|
||||
unescape = html.parse.HTMLParser().unescape
|
||||
|
@ -7,6 +7,7 @@
|
||||
# it under the terms of the GNU General Public License version 2 as
|
||||
# published by the Free Software Foundation.
|
||||
|
||||
import sys
|
||||
import unittest
|
||||
from gallery_dl import extractor, job, config
|
||||
|
||||
@ -14,8 +15,13 @@ from gallery_dl import extractor, job, config
|
||||
class TestExtractors(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
config.load()
|
||||
name = "gallerydl"
|
||||
email = "gallerydl@openaliasbox.org"
|
||||
config.set(("cache", "file"), ":memory:")
|
||||
config.set(("username",), name)
|
||||
config.set(("password",), name)
|
||||
config.set(("extractor", "nijie", "username"), email)
|
||||
config.set(("extractor", "seiga", "username"), email)
|
||||
|
||||
def _run_test(self, extr, url, result):
|
||||
hjob = job.HashJob(url, "content" in result)
|
||||
@ -40,10 +46,19 @@ def _generate_test(extr, tcase):
|
||||
self._run_test(extr, url, result)
|
||||
return test
|
||||
|
||||
# enable selective testing for direct calls
|
||||
extractors = extractor.extractors()
|
||||
if __name__ == '__main__' and len(sys.argv) > 1:
|
||||
print(sys.argv)
|
||||
extractors = [
|
||||
extr for extr in extractors
|
||||
if extr.category in sys.argv
|
||||
]
|
||||
del sys.argv[1:]
|
||||
|
||||
for extr in extractor.extractors():
|
||||
# disable extractors that require authentication for now
|
||||
if hasattr(extr, "login"):
|
||||
skip = ("exhentai", "kissmanga")
|
||||
for extr in extractors:
|
||||
if extr.category in skip:
|
||||
continue
|
||||
if hasattr(extr, "test") and extr.test:
|
||||
name = "test_" + extr.__name__ + "_"
|
||||
@ -51,7 +66,7 @@ for extr in extractor.extractors():
|
||||
test = _generate_test(extr, tcase)
|
||||
test.__name__ = name + str(num)
|
||||
setattr(TestExtractors, test.__name__, test)
|
||||
del test
|
||||
del test
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(warnings='ignore')
|
||||
|
Loading…
Reference in New Issue
Block a user