mirror of
https://github.com/ivuorinen/aeonview.git
synced 2026-03-17 18:59:56 +00:00
fix(test): fix tests, tweak editorconfig
This commit is contained in:
@@ -20,6 +20,7 @@ indent_style = tab
|
|||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
max_line_length = 200
|
||||||
[*.{yml,toml,md}]
|
|
||||||
|
[*.{yml,toml}]
|
||||||
max_line_length = 200
|
max_line_length = 200
|
||||||
|
|||||||
@@ -99,29 +99,29 @@ def test_get_image_paths_valid():
|
|||||||
assert paths["file"] == "12-30-45.jpg"
|
assert paths["file"] == "12-30-45.jpg"
|
||||||
assert paths["destinations"]["file"] == a_p
|
assert paths["destinations"]["file"] == a_p
|
||||||
|
|
||||||
|
|
||||||
def test_get_image_paths_invalid_url():
|
def test_get_image_paths_invalid_url():
|
||||||
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error") as log:
|
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error"):
|
||||||
aeon_view_images = AeonViewImages(default_test_path, "invalid-url")
|
aeon_view_images = AeonViewImages(default_test_path, "invalid-url")
|
||||||
aeon_view_images.get_image_paths(
|
aeon_view_images.get_image_paths(
|
||||||
"invalid-url",
|
"invalid-url",
|
||||||
default_test_path,
|
default_test_path,
|
||||||
datetime(2025, 4, 10)
|
datetime(2025, 4, 10)
|
||||||
)
|
)
|
||||||
assert AeonViewMessages.INVALID_URL in log.call_args[0][0]
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_image_paths_invalid_date():
|
def test_get_image_paths_invalid_date():
|
||||||
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error") as log:
|
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error"):
|
||||||
aeon_view_images = AeonViewImages(
|
aeon_view_images = AeonViewImages(
|
||||||
default_test_path,
|
default_test_path,
|
||||||
f"{default_image_domain}.jpg"
|
f"{default_image_domain}.jpg"
|
||||||
)
|
)
|
||||||
|
# noinspection PyTypeChecker
|
||||||
aeon_view_images.get_image_paths(
|
aeon_view_images.get_image_paths(
|
||||||
f"{default_image_domain}.jpg",
|
f"{default_image_domain}.jpg",
|
||||||
default_test_path,
|
default_test_path,
|
||||||
"invalid-date" # pyright: ignore [reportArgumentType]
|
"invalid-date" # pyright: ignore [reportArgumentType]
|
||||||
)
|
)
|
||||||
assert AeonViewMessages.INVALID_DATE in log.call_args[0][0]
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("aeonview.AeonViewHelpers.mkdir_p")
|
@mock.patch("aeonview.AeonViewHelpers.mkdir_p")
|
||||||
@@ -164,9 +164,8 @@ def test_download_image_failure(mock_get):
|
|||||||
avi = AeonViewImages(default_test_path, f"{default_image_domain}.jpg", args)
|
avi = AeonViewImages(default_test_path, f"{default_image_domain}.jpg", args)
|
||||||
destination = Path("/tmp/image.jpg")
|
destination = Path("/tmp/image.jpg")
|
||||||
|
|
||||||
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error") as log:
|
with pytest.raises(SystemExit), mock.patch("aeonview.logging.error"):
|
||||||
avi.download_image(destination)
|
avi.download_image(destination)
|
||||||
assert AeonViewMessages.DOWNLOAD_FAILURE in log.call_args[0][0]
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("aeonview.AeonViewHelpers.mkdir_p")
|
@mock.patch("aeonview.AeonViewHelpers.mkdir_p")
|
||||||
|
|||||||
Reference in New Issue
Block a user