This repository has been archived by the owner on Oct 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nhanb
committed
Jun 9, 2015
1 parent
90e588c
commit 42947be
Showing
3 changed files
with
54 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
def _test_series(case, site, url, expected): | ||
""" | ||
Helper to use in site-specific test cases. See test_kissmanga.py for usage. | ||
""" | ||
resp = site.get_manga_seed_page(url) | ||
if resp.status_code != 200: | ||
raise Exception('Failed to download series html') | ||
html = resp.text | ||
series = site.series_info(html) | ||
|
||
chapters = expected.pop('chapters', None) | ||
|
||
for key, val in expected.items(): | ||
case.assertEqual(getattr(series, key), val) | ||
|
||
if chapters is None: | ||
return | ||
case.assertEqual(series.chapters[-1], chapters['first']) | ||
if 'last' in chapters: | ||
case.assertEqual(series.chapters[0], chapters['last']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,35 @@ | ||
import unittest | ||
from fundoshi.sites.kissmanga import Kissmanga | ||
from . import _test_series | ||
site = Kissmanga() | ||
|
||
|
||
class TestSeriesInfo(unittest.TestCase): | ||
def test_series_info(self): | ||
pass | ||
class TestKissmangaSeries(unittest.TestCase): | ||
|
||
def test_completed_series(self): | ||
url = 'http://kissmanga.com/Manga/Beelzebub' | ||
expected = { | ||
'name': 'Beelzebub', | ||
'tags': ['action', 'comedy', 'fantasy', 'manga', 'school life', | ||
'shounen', 'supernatural'], | ||
'thumb_url': 'http://kissmanga.com/Uploads/Etc/8-17-2011/75210229ef3c651a3.jpg', | ||
'status': 'completed', | ||
'description': [ | ||
'The story follows the "strongest juvenile delinquent" as he watches over ' | ||
"the devil king's son (and future devil king) with the fate of the world " | ||
'hanging in the balance.' | ||
], | ||
'authors': ['Tamura Ryuuhei'], | ||
'chapters': { | ||
'last': { | ||
'url': 'http://kissmanga.com/Manga/Beelzebub/Ch-240--Last-Babu' | ||
'--Good-Babu--Ishiyama-High--End-?id=188430', | ||
'name': 'Beelzebub 240: Last Babu, Good Babu, Ishiyama High [End]' | ||
}, | ||
'first': { | ||
'url': 'http://kissmanga.com/Manga/Beelzebub/Vol-1-Ch-01-Read-Online?id=407', | ||
'name': 'Beelzebub 001 Read Online', | ||
}, | ||
}, | ||
} | ||
_test_series(self, site, url, expected) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
exclude = fundoshi/tests/test_* |