Skip to content

Commit

Permalink
test: autogen: use non-zero number for seconds in exif field
Browse files Browse the repository at this point in the history
To cover potential regressions, let's make sure that non-zero numbers
for seconds in exif fields are used to test autogen.

This is a follow up for the previous commit fixing a non-zero number of
seconds in exif fields when generating a gallery with no predefined
cover.

Signed-off-by: Quentin Schulz <[email protected]>
  • Loading branch information
QSchulz committed Jan 2, 2024
1 parent 3ca04fb commit 0b908fa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/test_autogen.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def test_existing_gallery(self, p, caplog):
"recitale.autogen.load_settings",
return_value={"title": "test", "cover": "test.jpg"},
)
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:00")
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:10")
def test_missing_date(self, patch_exif, patch_load):
with TemporaryDirectory() as td:
f = "test.png"
Expand All @@ -176,7 +176,7 @@ def test_missing_date(self, patch_exif, patch_load):
"recitale.autogen.load_settings",
return_value={"title": "test", "date": "20230610"},
)
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:00")
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:10")
def test_missing_cover(self, patch_exif, patch_load):
with TemporaryDirectory() as td:
f = "test.png"
Expand Down Expand Up @@ -204,7 +204,7 @@ def test_missing_cover(self, patch_exif, patch_load):
)
@patch(
"recitale.autogen.get_exif",
side_effect=["2023:06:10 10:10:00", "2016:10:08 01:01:00"],
side_effect=["2023:06:10 10:10:10", "2016:10:08 01:01:01"],
)
def test_missing_cover_oldest_picked(self, patch_exif, patch_load):
with TemporaryDirectory() as td:
Expand Down Expand Up @@ -234,7 +234,7 @@ def test_missing_cover_oldest_picked(self, patch_exif, patch_load):
"recitale.autogen.load_settings",
return_value={"title": "test", "cover": "test.jpg", "date": "20230610"},
)
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:00")
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:10")
@pytest.mark.parametrize("filext", recitale.autogen.types)
def test_file_extensions(self, patch_exif, patch_load, filext):
with TemporaryDirectory() as td:
Expand Down Expand Up @@ -266,7 +266,7 @@ def test_file_extensions(self, patch_exif, patch_load, filext):
"sections": [],
},
)
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:00")
@patch("recitale.autogen.get_exif", return_value="2023:06:10 10:10:10")
def test_overwrite_existing(self, patch_exif, patch_load):
with TemporaryDirectory() as td:
f = "test.JPG"
Expand Down Expand Up @@ -309,8 +309,8 @@ def test_no_datetime_exifs(self, patched_getmtime):
@pytest.mark.parametrize("exif", [0x9003, 0x9004, 0x0132])
def test_datetime_exifs(self, exif):
with patch("recitale.autogen.Image.open") as p:
p.return_value.getexif.return_value = {exif: "2023:06:10 10:10:00"}
p.return_value.getexif.return_value = {exif: "2023:06:10 10:10:10"}
assert (
recitale.autogen.get_exif("example/first_gallery/stuff.png")
== "2023:06:10 10:10:00"
== "2023:06:10 10:10:10"
)

0 comments on commit 0b908fa

Please sign in to comment.