dosage/tests/test_comicnames.py

31 lines
1.1 KiB
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2016-10-28 22:21:41 +00:00
# Copyright (C) 2004-2008 Tristan Seligmann and Jonathan Jacobs
2014-01-05 15:50:57 +00:00
# Copyright (C) 2012-2014 Bastian Kleineidam
# Copyright (C) 2015-2019 Tobias Gruetzmacher
2016-04-12 23:32:15 +00:00
import re
from dosagelib import scraper
from dosagelib.plugins import old
2012-12-12 16:41:29 +00:00
class TestComicNames(object):
2012-12-12 16:41:29 +00:00
def test_names(self):
for scraperobj in scraper.get_scrapers():
name = scraperobj.name
assert name.count('/') <= 1
2012-12-12 16:41:29 +00:00
if '/' in name:
comicname = name.split('/')[1]
else:
comicname = name
2016-04-12 23:32:15 +00:00
assert re.sub("[^0-9a-zA-Z_]", "", comicname) == comicname
def test_renamed(self):
for scraperobj in scraper.get_scrapers(include_removed=True):
if not isinstance(scraperobj, old.Renamed):
continue
assert len(scraperobj.getDisabledReasons()) > 0
# Renamed scraper should only point to an non-disabled scraper
newscraper = scraper.find_scrapers(scraperobj.newname)[0]
assert len(newscraper.getDisabledReasons()) == 0