|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
|
import pickle |
|
|
|
|
import pytest |
|
|
|
|
|
|
|
|
|
from sigal.gallery import Gallery |
|
|
|
|
from sigal.plugins import extended_caching |
|
|
|
|
@ -9,7 +10,14 @@ from sigal.plugins import extended_caching
|
|
|
|
|
CURRENT_DIR = os.path.dirname(__file__) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_save_cache(settings): |
|
|
|
|
@pytest.fixture() |
|
|
|
|
def remove_cache(settings): |
|
|
|
|
yield |
|
|
|
|
cachepath = os.path.join(settings['destination'], ".exif_cache") |
|
|
|
|
os.remove(cachepath) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_save_cache(settings, remove_cache): |
|
|
|
|
gal = Gallery(settings, ncpu=1) |
|
|
|
|
extended_caching.save_cache(gal) |
|
|
|
|
|
|
|
|
|
@ -25,7 +33,7 @@ def test_save_cache(settings):
|
|
|
|
|
assert cache["exifTest/noexif.png"] == gal.albums["exifTest"].medias[2].exif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_restore_cache(settings): |
|
|
|
|
def test_restore_cache(settings, remove_cache): |
|
|
|
|
gal1 = Gallery(settings, ncpu=1) |
|
|
|
|
gal2 = Gallery(settings, ncpu=1) |
|
|
|
|
extended_caching.save_cache(gal1) |
|
|
|
|
@ -33,7 +41,7 @@ def test_restore_cache(settings):
|
|
|
|
|
assert gal1.exifCache == gal2.exifCache |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_load_exif(settings): |
|
|
|
|
def test_load_exif(settings, remove_cache): |
|
|
|
|
gal1 = Gallery(settings, ncpu=1) |
|
|
|
|
gal1.albums["exifTest"].medias[2].exif = "blafoo" |
|
|
|
|
gal1.exifCache = {"exifTest/21.jpg": "Foo", |
|
|
|
|
|