Skip to content

Commit

Permalink
Merge pull request #81 from J-CPelletier/79-bug-with-custom-parameter…
Browse files Browse the repository at this point in the history
…s-on-380

Fix issue with custom command
  • Loading branch information
J-CPelletier committed Feb 20, 2024
2 parents 9ac3e14 + 9d14775 commit 916e25e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "webcomix"
version = "3.8.0"
version = "3.8.1"
description = "Webcomic downloader"
authors = ["Jean-Christophe Pelletier <pelletierj97@gmail.com>"]
readme = "README.md"
Expand Down
28 changes: 14 additions & 14 deletions webcomix/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ def search(
comic, validation = discovery(
name,
start_url,
start_page,
alt_text,
single_page,
javascript,
title,
verbose,
start_page=start_page,
alt_text=alt_text,
single_page=single_page,
javascript=javascript,
title=title,
debug=verbose,
)
if comic is not None:
print_verification(validation)
Expand Down Expand Up @@ -234,16 +234,16 @@ def custom(
comic = Comic(
name,
start_url,
end_url,
image_xpath,
next_page_xpath,
block_xpath,
start_page,
alt_text,
single_page,
javascript,
title,
verbose,
end_url=end_url,
block_selectors=block_xpath,
start_page=start_page,
alt_text=alt_text,
single_page=single_page,
javascript=javascript,
title=title,
debug=verbose,
)
try:
validation = comic.verify_xpath()
Expand Down
18 changes: 18 additions & 0 deletions webcomix/tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
three_webpages_uri,
three_webpages_alt_text_uri,
)
from webcomix.tests.test_comic import cleanup_test_directories

first_comic = list(sorted(supported_comics.keys()))[0]

Expand Down Expand Up @@ -291,6 +292,23 @@ def test_custom_comic_downloads_comic_with_multiple_xpath_blocklist_entries(mock
assert result.exit_code == 0


def test_custom_comic_integration(cleanup_test_directories, three_webpages_uri):
runner = CliRunner()

result = runner.invoke(
cli.custom,
[
"xkcd",
"--start_url=" + three_webpages_uri,
"--next_page_xpath=//a/@href",
"--image_xpath=//img/@src",
],
"yes",
)

assert result.exit_code == 0


def test_discovered_comic_searches_for_a_comic(mocker):
runner = CliRunner()
mock_discovery = mocker.patch(
Expand Down

0 comments on commit 916e25e

Please sign in to comment.