aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wikiget/dl.py2
-rw-r--r--tests/test_dl.py3
2 files changed, 2 insertions, 3 deletions
diff --git a/src/wikiget/dl.py b/src/wikiget/dl.py
index 60405d0..722bf62 100644
--- a/src/wikiget/dl.py
+++ b/src/wikiget/dl.py
@@ -184,7 +184,7 @@ def download(f: File, args: Namespace) -> int:
# prepend the current filename to all log messages
adapter = FileLogAdapter(logger, {"filename": filename})
- if file.exists:
+ if file.imageinfo:
# file exists either locally or at a common repository, like Wikimedia Commons
file_url = file.imageinfo["url"]
file_size = file.imageinfo["size"]
diff --git a/tests/test_dl.py b/tests/test_dl.py
index cb893b8..e062116 100644
--- a/tests/test_dl.py
+++ b/tests/test_dl.py
@@ -307,7 +307,6 @@ class TestDownload:
"""
file = File(name="Example.jpg")
file.image = Mock()
- file.image.exists = True
file.image.imageinfo = {
"url": "https://upload.wikimedia.org/wikipedia/commons/a/a9/Example.jpg",
"size": 9022,
@@ -475,7 +474,7 @@ class TestDownload:
self, mock_file: File, caplog: pytest.LogCaptureFixture
) -> None:
"""Test that a warning message is logged if no file info was returned."""
- mock_file.image.exists = False
+ mock_file.image.imageinfo = {}
args = parse_args(["File:Example.jpg"])
errors = download(mock_file, args)