def test_get_thumb(settings): """Test the get_thumb function.""" tests = [('example.jpg', 'thumbnails/example.tn.jpg'), ('test/example.jpg', 'test/thumbnails/example.tn.jpg'), ('test/t/example.jpg', 'test/t/thumbnails/example.tn.jpg')] for src, ref in tests: assert get_thumb(settings, src) == ref tests = [('example.webm', 'thumbnails/example.tn.jpg'), ('test/example.mp4', 'test/thumbnails/example.tn.jpg'), ('test/t/example.avi', 'test/t/thumbnails/example.tn.jpg')] for src, ref in tests: assert get_thumb(settings, src) == ref
def get_encrypt_list(settings, media): to_encrypt = [] to_encrypt.append( media.filename) #resized image or in case of "use_orig", the original if settings["make_thumbs"]: to_encrypt.append(get_thumb(settings, media.filename)) #thumbnail if media.big is not None and not settings["use_orig"]: to_encrypt.append(media.big) #original image to_encrypt = list( map(lambda path: os.path.join(media.path, path), to_encrypt)) return to_encrypt