Added test for #576
This commit is contained in:
@@ -768,7 +768,10 @@ CLI_EXPORT_UUID_FROM_FILE_FILENAMES = [
|
|||||||
"wedding_edited.jpeg",
|
"wedding_edited.jpeg",
|
||||||
]
|
]
|
||||||
|
|
||||||
CLI_EXPORT_SKIP_UUID = ["E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51", "6191423D-8DB8-4D4C-92BE-9BBBA308AAC4"]
|
CLI_EXPORT_SKIP_UUID = [
|
||||||
|
"E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51",
|
||||||
|
"6191423D-8DB8-4D4C-92BE-9BBBA308AAC4",
|
||||||
|
]
|
||||||
CLI_EXPORT_SKIP_UUID_FILENAMES = [
|
CLI_EXPORT_SKIP_UUID_FILENAMES = [
|
||||||
"Tulips.jpg",
|
"Tulips.jpg",
|
||||||
"Tulips_edited.jpeg",
|
"Tulips_edited.jpeg",
|
||||||
@@ -903,6 +906,14 @@ QUERY_EXIF_DATA_CASE_INSENSITIVE = [
|
|||||||
]
|
]
|
||||||
EXPORT_EXIF_DATA = [("EXIF:Make", "FUJIFILM", ["Tulips.jpg", "Tulips_edited.jpeg"])]
|
EXPORT_EXIF_DATA = [("EXIF:Make", "FUJIFILM", ["Tulips.jpg", "Tulips_edited.jpeg"])]
|
||||||
|
|
||||||
|
UUID_LIVE_EDITED = "136A78FA-1B90-46CC-88A7-CCA3331F0353" # IMG_4813.HEIC
|
||||||
|
CLI_EXPORT_LIVE_EDITED = [
|
||||||
|
"IMG_4813.HEIC",
|
||||||
|
"IMG_4813.mov",
|
||||||
|
"IMG_4813_edited.jpeg",
|
||||||
|
"IMG_4813_edited.mov",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def modify_file(filename):
|
def modify_file(filename):
|
||||||
"""appends data to a file to modify it"""
|
"""appends data to a file to modify it"""
|
||||||
@@ -1268,7 +1279,8 @@ def test_query_duplicate():
|
|||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
query, ["--json", "--db", os.path.join(cwd, CLI_PHOTOS_DB), "--duplicate"],
|
query,
|
||||||
|
["--json", "--db", os.path.join(cwd, CLI_PHOTOS_DB), "--duplicate"],
|
||||||
)
|
)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
@@ -1289,7 +1301,8 @@ def test_query_location():
|
|||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
query, ["--json", "--db", os.path.join(cwd, CLI_PHOTOS_DB), "--location"],
|
query,
|
||||||
|
["--json", "--db", os.path.join(cwd, CLI_PHOTOS_DB), "--location"],
|
||||||
)
|
)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
@@ -1311,7 +1324,8 @@ def test_query_no_location():
|
|||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
result = runner.invoke(
|
result = runner.invoke(
|
||||||
query, ["--json", "--db", os.path.join(cwd, CLI_PHOTOS_DB), "--no-location"],
|
query,
|
||||||
|
["--json", "--db", os.path.join(cwd, CLI_PHOTOS_DB), "--no-location"],
|
||||||
)
|
)
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
|
|
||||||
@@ -1432,6 +1446,7 @@ def test_export_uuid_from_file():
|
|||||||
files = glob.glob("*")
|
files = glob.glob("*")
|
||||||
assert sorted(files) == sorted(CLI_EXPORT_UUID_FROM_FILE_FILENAMES)
|
assert sorted(files) == sorted(CLI_EXPORT_UUID_FROM_FILE_FILENAMES)
|
||||||
|
|
||||||
|
|
||||||
def test_export_skip_uuid_from_file():
|
def test_export_skip_uuid_from_file():
|
||||||
"""Test export with --skip-uuid-from-file"""
|
"""Test export with --skip-uuid-from-file"""
|
||||||
import glob
|
import glob
|
||||||
@@ -1460,6 +1475,7 @@ def test_export_skip_uuid_from_file():
|
|||||||
for skipped_file in CLI_EXPORT_SKIP_UUID_FILENAMES:
|
for skipped_file in CLI_EXPORT_SKIP_UUID_FILENAMES:
|
||||||
assert skipped_file not in files
|
assert skipped_file not in files
|
||||||
|
|
||||||
|
|
||||||
def test_export_skip_uuid():
|
def test_export_skip_uuid():
|
||||||
"""Test export with --skip-uuid"""
|
"""Test export with --skip-uuid"""
|
||||||
import glob
|
import glob
|
||||||
@@ -4304,7 +4320,7 @@ def test_export_error(monkeypatch):
|
|||||||
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
|
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
|
||||||
@pytest.mark.parametrize("exiftag,exifvalue,files_expected", EXPORT_EXIF_DATA)
|
@pytest.mark.parametrize("exiftag,exifvalue,files_expected", EXPORT_EXIF_DATA)
|
||||||
def test_export_exif(exiftag, exifvalue, files_expected):
|
def test_export_exif(exiftag, exifvalue, files_expected):
|
||||||
"""Test export --exif query """
|
"""Test export --exif query"""
|
||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
@@ -4665,6 +4681,32 @@ def test_export_update_basic():
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skipif(
|
||||||
|
"OSXPHOTOS_TEST_EXPORT" not in os.environ,
|
||||||
|
reason="Skip if not running on author's personal library.",
|
||||||
|
)
|
||||||
|
def test_export_live_edited():
|
||||||
|
"""test export of edited live image #576"""
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
from osxphotos.cli import OSXPHOTOS_EXPORT_DB, export
|
||||||
|
|
||||||
|
runner = CliRunner()
|
||||||
|
cwd = os.getcwd()
|
||||||
|
# pylint: disable=not-context-manager
|
||||||
|
with runner.isolated_filesystem():
|
||||||
|
# basic export
|
||||||
|
result = runner.invoke(
|
||||||
|
export,
|
||||||
|
[os.path.join(cwd, PHOTOS_DB_RHET), ".", "-V", "--uuid", UUID_LIVE_EDITED],
|
||||||
|
)
|
||||||
|
assert result.exit_code == 0
|
||||||
|
files = glob.glob("*")
|
||||||
|
assert sorted(files) == sorted(CLI_EXPORT_LIVE_EDITED)
|
||||||
|
|
||||||
|
|
||||||
def test_export_update_child_folder():
|
def test_export_update_child_folder():
|
||||||
"""test export then update into a child folder of previous export"""
|
"""test export then update into a child folder of previous export"""
|
||||||
import glob
|
import glob
|
||||||
@@ -7642,6 +7684,7 @@ def test_export_query_function():
|
|||||||
def test_export_album_seq():
|
def test_export_album_seq():
|
||||||
"""Test {album_seq} template"""
|
"""Test {album_seq} template"""
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
from osxphotos.cli import cli
|
from osxphotos.cli import cli
|
||||||
|
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
@@ -7719,7 +7762,6 @@ def test_export_description_template_conditional():
|
|||||||
import osxphotos
|
import osxphotos
|
||||||
from osxphotos.cli import cli
|
from osxphotos.cli import cli
|
||||||
from osxphotos.exiftool import ExifTool
|
from osxphotos.exiftool import ExifTool
|
||||||
import json
|
|
||||||
|
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
|
|||||||
Reference in New Issue
Block a user