This commit is contained in:
Simon Conseil
2021-02-07 18:47:52 -03:00
parent d09a620341
commit 04b37a21a0
2 changed files with 20 additions and 1 deletions

View File

@@ -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 == "<p>This is a funny description of this image</p>"
file_path = join(path, '11.tiff')
assert repr(m) == f"<Image>('{file_path}')"
assert str(m) == file_path
def test_image(settings, tmpdir):
settings['destination'] = str(tmpdir)
settings['datetime_format'] = '%d/%m/%Y'

View File

@@ -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)