Added exportdb test for #990

This commit is contained in:
Rhet Turnbull 2023-02-19 22:54:13 -08:00
parent a46f8bd244
commit 31212a1daa

View File

@ -0,0 +1,36 @@
"""Test osxphotos exportdb cli command"""
import os
from click.testing import CliRunner
from osxphotos.cli.export import export
from osxphotos.cli.exportdb import exportdb
LIBRARY1 = "tests/Test-Cloud-10.15.6.photoslibrary"
LIBRARY2 = "tests/Test-Cloud-13.1.photoslibrary"
def test_exportdb_migrate_photos_library():
"""Test exportdb --migrate-photos-library"""
runner = CliRunner()
cwd = os.getcwd()
with runner.isolated_filesystem():
# export first version of library
result = runner.invoke(export, [".", "--library", os.path.join(cwd, LIBRARY1)])
assert result.exit_code == 0
# run the exportdb command
result = runner.invoke(
exportdb,
[
".",
"--migrate-photos-library",
os.path.join(cwd, LIBRARY2),
"--verbose",
],
input="Y\n",
)
assert result.exit_code == 0
assert "Migrated 29 photos" in result.output