add a test to increase code coverage

This commit is contained in:
David Schultz
2022-01-28 15:49:25 -06:00
parent 10e18cf537
commit 47c8cf786a
3 changed files with 9 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ files_to_copy = (("../watermark.png", "watermark.png"),)
plugins = [
"sigal.plugins.adjust",
"sigal.plugins.copyright",
"sigal.plugins.extended_caching",
"sigal.plugins.feeds",
"sigal.plugins.nomedia",
"sigal.plugins.watermark",

View File

@@ -8,7 +8,6 @@ CURRENT_DIR = os.path.dirname(__file__)
def test_save_cache(settings, tmpdir):
settings['plugins'].append('sigal.plugins.extended_caching')
settings['destination'] = str(tmpdir)
gal = Gallery(settings, ncpu=1)
extended_caching.save_cache(gal)
@@ -50,7 +49,6 @@ def test_save_cache(settings, tmpdir):
def test_restore_cache(settings, tmpdir):
settings['plugins'].append('sigal.plugins.extended_caching')
settings['destination'] = str(tmpdir)
gal1 = Gallery(settings, ncpu=1)
gal2 = Gallery(settings, ncpu=1)
@@ -60,7 +58,6 @@ def test_restore_cache(settings, tmpdir):
def test_load_exif(settings, tmpdir):
settings['plugins'].append('sigal.plugins.extended_caching')
settings['destination'] = str(tmpdir)
gal1 = Gallery(settings, ncpu=1)
gal1.albums["exifTest"].medias[2].exif = "blafoo"

View File

@@ -12,6 +12,7 @@ from sigal.image import (
get_exif_data,
get_exif_tags,
get_iptc_data,
get_image_metadata,
get_size,
process_image,
)
@@ -241,6 +242,13 @@ def test_get_iptc_data(caplog):
assert ['IPTC Error in'] == [log.message[:13] for log in caplog.records]
def test_get_image_metadata_bad(caplog):
test_image = 'bad_image.jpg'
src_file = os.path.join(CURRENT_DIR, 'sample', test_image)
data = get_image_metadata(src_file)
assert data == {'exif': {}, 'iptc': {}, 'size': {}}
def test_iso_speed_ratings():
data = {'ISOSpeedRatings': ()}
simple = get_exif_tags(data)