fix tests for changes
This commit is contained in:
parent
08cb16656d
commit
718c3ea484
2 changed files with 38 additions and 2 deletions
|
@ -3,6 +3,7 @@ from pathlib import Path
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import mangadlp.app as app
|
||||||
import mangadlp.utils as utils
|
import mangadlp.utils as utils
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +47,41 @@ def test_chapter_list_forcevol():
|
||||||
assert utils.get_chapter_list(chapters_in) == chapters_out
|
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():
|
def test_fix_name():
|
||||||
filename_in1 = r"..hello?; @test1-*<\>test2.cbz.."
|
filename_in1 = r"..hello?; @test1-*<\>test2.cbz.."
|
||||||
filename_in2 = r"!hello: >test1-/test2<!.cbz"
|
filename_in2 = r"!hello: >test1-/test2<!.cbz"
|
||||||
|
|
|
@ -16,7 +16,7 @@ def test_downloader():
|
||||||
chapter_path = Path("tests/test_folder1")
|
chapter_path = Path("tests/test_folder1")
|
||||||
chapter_path.mkdir(parents=True, exist_ok=True)
|
chapter_path.mkdir(parents=True, exist_ok=True)
|
||||||
images = []
|
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():
|
for file in chapter_path.iterdir():
|
||||||
images.append(file.name)
|
images.append(file.name)
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ def test_downloader_fail(monkeypatch):
|
||||||
chapter_path.mkdir(parents=True, exist_ok=True)
|
chapter_path.mkdir(parents=True, exist_ok=True)
|
||||||
monkeypatch.setattr(requests, "get", fail_url)
|
monkeypatch.setattr(requests, "get", fail_url)
|
||||||
with pytest.raises(ConnectionError) as e:
|
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
|
assert e.type == ConnectionError
|
||||||
# cleanup
|
# cleanup
|
||||||
|
|
Loading…
Reference in a new issue