fix tests for changes

This commit is contained in:
Ivan Schaller 2022-05-19 00:25:25 +02:00
parent 08cb16656d
commit 718c3ea484
2 changed files with 38 additions and 2 deletions

View file

@ -3,6 +3,7 @@ from pathlib import Path
import pytest
import mangadlp.app as app
import mangadlp.utils as utils
@ -46,6 +47,41 @@ def test_chapter_list_forcevol():
assert utils.get_chapter_list(chapters_in) == chapters_out
def test_chapter_list_full():
mdlp = app.MangaDLP(
url_uuid="https://mangadex.org/title/0aea9f43-d4a9-4bf7-bebc-550a512f9b95/shikimori-s-not-just-a-cutie",
language="en",
chapters="",
readlist="",
list_chapters=True,
file_format="cbz",
forcevol=True,
download_path="tests",
download_wait=0.5,
verbose=True,
)
mdlp.__main__()
chap_list = utils.get_chapter_list("1:1,1:2,1:4-1:7,2:", mdlp.manga_chapter_list)
assert chap_list == [
"1:1",
"1:2",
"1:4",
"1:5",
"1:6",
"1:7",
"2:17",
"2:18",
"2:19",
"2:20",
"2:21",
"2:22",
"2:23",
"2:24",
"2:25",
"2:26",
]
def test_fix_name():
filename_in1 = r"..hello?; @test1-*<\>test2.cbz.."
filename_in2 = r"!hello: >test1-/test2<!.cbz"

View file

@ -16,7 +16,7 @@ def test_downloader():
chapter_path = Path("tests/test_folder1")
chapter_path.mkdir(parents=True, exist_ok=True)
images = []
assert downloader.download_chapter(urls, chapter_path, 0.5, True)
downloader.download_chapter(urls, str(chapter_path), 0.5, True)
for file in chapter_path.iterdir():
images.append(file.name)
@ -41,7 +41,7 @@ def test_downloader_fail(monkeypatch):
chapter_path.mkdir(parents=True, exist_ok=True)
monkeypatch.setattr(requests, "get", fail_url)
with pytest.raises(ConnectionError) as e:
downloader.download_chapter(images, chapter_path, 0.5, True)
downloader.download_chapter(images, str(chapter_path), 0.5, True)
assert e.type == ConnectionError
# cleanup