diff --git a/archivebox/extractors/__init__.py b/archivebox/extractors/__init__.py index 1acefdf4..437ca4ec 100644 --- a/archivebox/extractors/__init__.py +++ b/archivebox/extractors/__init__.py @@ -162,7 +162,7 @@ def archive_link(link: Link, overwrite: bool=False, methods: Optional[Iterable[s write_link_details(link, out_dir=out_dir, skip_sql_index=False) - log_link_archiving_finished(link, link.link_dir, is_new, stats, start_ts) + log_link_archiving_finished(link, out_dir or link.link_dir, is_new, stats, start_ts) except KeyboardInterrupt: try: diff --git a/tests/test_oneshot.py b/tests/test_oneshot.py index 560ac43c..fb9ea39f 100644 --- a/tests/test_oneshot.py +++ b/tests/test_oneshot.py @@ -25,4 +25,36 @@ def test_oneshot_command_saves_page_in_right_folder(tmp_path, disable_extractors assert "index.json" in items assert not "index.sqlite3" in current_path assert "output.html" in items - + +def test_oneshot_command_succeeds(tmp_path, disable_extractors_dict): + disable_extractors_dict.update({"SAVE_DOM": "true"}) + process = subprocess.run( + [ + "archivebox", + "oneshot", + f"--out-dir={tmp_path}", + "--extract=title,favicon,dom", + "http://127.0.0.1:8080/static/example.com.html", + ], + capture_output=True, + env=disable_extractors_dict, + ) + + assert process.returncode == 0 + +def test_oneshot_command_logs_archiving_finished(tmp_path, disable_extractors_dict): + disable_extractors_dict.update({"SAVE_DOM": "true"}) + process = subprocess.run( + [ + "archivebox", + "oneshot", + f"--out-dir={tmp_path}", + "--extract=title,favicon,dom", + "http://127.0.0.1:8080/static/example.com.html", + ], + capture_output=True, + env=disable_extractors_dict, + ) + + output_str = process.stdout.decode("utf-8") + assert "4 files" in output_str