This commit is contained in:
Rhet Turnbull
2021-10-11 17:50:07 -07:00
parent a0c654e43f
commit 202bc1144b
14 changed files with 68 additions and 15 deletions

View File

@@ -1483,6 +1483,50 @@ def test_export_preview_if_missing():
assert sorted(files) == sorted(expected_files)
def test_export_preview_overwrite():
"""test export with --preview and --overwrite (#526)"""
import glob
import os
import os.path
import osxphotos
from osxphotos.cli import export
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
export,
[
os.path.join(cwd, CLI_PHOTOS_DB),
".",
"-V",
"--preview",
"--uuid",
CLI_EXPORT_UUID,
],
)
assert result.exit_code == 0
# export again
result = runner.invoke(
export,
[
os.path.join(cwd, CLI_PHOTOS_DB),
".",
"-V",
"--preview",
"--uuid",
CLI_EXPORT_UUID,
"--overwrite",
],
)
assert result.exit_code == 0
files = glob.glob("*")
assert len(files) == 2 # preview + original
def test_export_as_hardlink():
import glob
import os
@@ -6958,6 +7002,7 @@ def test_query_regex_multiple():
assert len(json_got) == 2
def test_query_function():
"""test query --query-function"""
import json