diff --git a/tests/test_gallery.py b/tests/test_gallery.py index 61a5aca..da5640e 100644 --- a/tests/test_gallery.py +++ b/tests/test_gallery.py @@ -2,7 +2,6 @@ import datetime import logging import os from os.path import join -from urllib.parse import quote import pytest @@ -127,6 +126,25 @@ def test_media_iptc_override(settings): ) +def test_media_img_format(settings): + settings['img_format'] = 'jpeg' + m = Image('11.tiff', 'dir1/test1', settings) + path = join('dir1', 'test1') + thumb = join('thumbnails', '11.tn.jpeg') + + assert m.dst_filename == '11.jpeg' + assert m.src_path == join(settings['source'], path, '11.tiff') + assert m.dst_path == join(settings['destination'], path, '11.jpeg') + assert m.thumb_name == thumb + assert m.thumb_path == join(settings['destination'], path, thumb) + assert m.title == "Foo Bar" + assert m.description == "

This is a funny description of this image

" + + file_path = join(path, '11.tiff') + assert repr(m) == f"('{file_path}')" + assert str(m) == file_path + + def test_image(settings, tmpdir): settings['destination'] = str(tmpdir) settings['datetime_format'] = '%d/%m/%Y' diff --git a/tests/test_image.py b/tests/test_image.py index ecca13c..2d20156 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -63,6 +63,7 @@ def test_generate_image_imgformat(tmpdir): im = PILImage.open(dstfile) assert im.format == outfmt + def test_resize_image_portrait(tmpdir): """Test that the area is the same regardless of aspect ratio.""" size = (300, 200)