From 32b95fdd831cd6370dcacc0f2f7e7db4c6032f42 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Pelletier Date: Mon, 19 Feb 2024 21:59:01 -0500 Subject: [PATCH 1/4] Add integration test to CLI --- webcomix/tests/test_cli.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/webcomix/tests/test_cli.py b/webcomix/tests/test_cli.py index eeefd43..282a478 100644 --- a/webcomix/tests/test_cli.py +++ b/webcomix/tests/test_cli.py @@ -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] @@ -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, + [ + "foo", + "--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( From 33f657f0f47952fdf7300d6e1c97adf14eb1a433 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Pelletier Date: Mon, 19 Feb 2024 22:01:06 -0500 Subject: [PATCH 2/4] Fix argument order in constructor --- webcomix/cli.py | 2 +- webcomix/tests/test_cli.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webcomix/cli.py b/webcomix/cli.py index 187e255..268048b 100644 --- a/webcomix/cli.py +++ b/webcomix/cli.py @@ -234,9 +234,9 @@ def custom( comic = Comic( name, start_url, - end_url, image_xpath, next_page_xpath, + end_url, block_xpath, start_page, alt_text, diff --git a/webcomix/tests/test_cli.py b/webcomix/tests/test_cli.py index 282a478..5e4f7fc 100644 --- a/webcomix/tests/test_cli.py +++ b/webcomix/tests/test_cli.py @@ -298,7 +298,7 @@ def test_custom_comic_integration(cleanup_test_directories, three_webpages_uri): result = runner.invoke( cli.custom, [ - "foo", + "xkcd", "--start_url=" + three_webpages_uri, "--next_page_xpath=//a/@href", "--image_xpath=//img/@src", From 2f8acb3f946c17421542b1cfc52e6219f3ff98f7 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Pelletier Date: Mon, 19 Feb 2024 22:06:51 -0500 Subject: [PATCH 3/4] Use keyword arguments without using position --- webcomix/cli.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/webcomix/cli.py b/webcomix/cli.py index 268048b..badfa00 100644 --- a/webcomix/cli.py +++ b/webcomix/cli.py @@ -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) @@ -236,14 +236,14 @@ def custom( start_url, image_xpath, next_page_xpath, - end_url, - 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() From 9d1477580e869c3fcd9286449b9a65c7f1c4b6a2 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Pelletier Date: Mon, 19 Feb 2024 22:06:57 -0500 Subject: [PATCH 4/4] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 89c29e4..96f2be5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "webcomix" -version = "3.8.0" +version = "3.8.1" description = "Webcomic downloader" authors = ["Jean-Christophe Pelletier "] readme = "README.md"