Browse Source

add a test to increase code coverage

pull/443/head
David Schultz 4 years ago
parent
commit
47c8cf786a
  1. 1
      tests/sample/sigal.conf.py
  2. 3
      tests/test_extended_caching.py
  3. 8
      tests/test_image.py

1
tests/sample/sigal.conf.py

@ -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",

3
tests/test_extended_caching.py

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

8
tests/test_image.py

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

Loading…
Cancel
Save