Added --exiftool-option to CLI, closes #298

This commit is contained in:
Rhet Turnbull
2020-12-21 07:32:38 -08:00
parent aca19f4063
commit a4bbb6492d
8 changed files with 137 additions and 13 deletions

View File

@@ -1059,7 +1059,9 @@ def test_export_exiftool_ignore_date_modified():
).asdict()
for key in CLI_EXIFTOOL_IGNORE_DATE_MODIFIED[uuid]:
if type(exif[key]) == list:
assert sorted(exif[key]) == sorted(CLI_EXIFTOOL_IGNORE_DATE_MODIFIED[uuid][key])
assert sorted(exif[key]) == sorted(
CLI_EXIFTOOL_IGNORE_DATE_MODIFIED[uuid][key]
)
else:
assert exif[key] == CLI_EXIFTOOL_IGNORE_DATE_MODIFIED[uuid][key]
@@ -1172,6 +1174,43 @@ def test_export_exiftool_error():
assert exif[key] == CLI_EXIFTOOL[uuid][key]
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
def test_export_exiftool_option():
""" test --exiftool-option """
import glob
import os
import os.path
from osxphotos.__main__ import export
from osxphotos.exiftool import ExifTool
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
# first export with --exiftool, one file produces a warning
result = runner.invoke(
export, [os.path.join(cwd, PHOTOS_DB_15_7), ".", "-V", "--exiftool"]
)
assert result.exit_code == 0
assert "exiftool warning" in result.output
# run again with exiftool-option = "-m" (ignore minor warnings)
# shouldn't see the warning this time
result = runner.invoke(
export,
[
os.path.join(cwd, PHOTOS_DB_15_7),
".",
"-V",
"--exiftool",
"--exiftool-option",
"-m",
],
)
assert result.exit_code == 0
assert "exiftool warning" not in result.output
def test_export_edited_suffix():
""" test export with --edited-suffix """
import glob