2020-04-18 11:45:44 +00:00
|
|
|
# SPDX-License-Identifier: MIT
|
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
|
2022-06-04 08:56:25 +00:00
|
|
|
# Copyright (C) 2015-2022 Tobias Gruetzmacher
|
2016-04-12 23:32:15 +00:00
|
|
|
import re
|
2024-03-17 18:21:41 +00:00
|
|
|
from operator import attrgetter
|
|
|
|
|
|
|
|
import pytest
|
2016-04-12 23:32:15 +00:00
|
|
|
|
2020-10-01 16:49:14 +00:00
|
|
|
from dosagelib.scraper import scrapers
|
2019-12-29 19:50:56 +00:00
|
|
|
from dosagelib.plugins import old
|
2012-12-12 16:41:29 +00:00
|
|
|
|
|
|
|
|
2024-03-17 18:21:41 +00:00
|
|
|
class TestComicNames:
|
2012-12-12 16:41:29 +00:00
|
|
|
|
|
|
|
def test_names(self):
|
2022-06-04 08:56:25 +00:00
|
|
|
for scraperobj in scrapers.all():
|
2016-04-13 20:05:44 +00:00
|
|
|
name = scraperobj.name
|
2016-03-07 00:08:57 +00:00
|
|
|
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
|
2019-12-29 19:50:56 +00:00
|
|
|
|
2024-03-17 18:21:41 +00:00
|
|
|
@pytest.mark.parametrize(('scraperobj'),
|
|
|
|
[obj for obj in scrapers.all(include_removed=True)
|
|
|
|
if isinstance(obj, old.Renamed)], ids=attrgetter('name'))
|
|
|
|
def test_renamed(self, scraperobj):
|
|
|
|
assert len(scraperobj.getDisabledReasons()) > 0
|
|
|
|
# Renamed scraper should only point to an non-disabled scraper
|
|
|
|
newscraper = scrapers.find(scraperobj.newname)
|
|
|
|
assert len(newscraper.getDisabledReasons()) == 0
|