Feature orphans (#755)

* Initial implementation of orphan command

* Implemented orphans command, #84
This commit is contained in:
Rhet Turnbull
2022-08-13 08:43:02 -07:00
committed by GitHub
parent 2103d8bcad
commit 38a5998063
5 changed files with 195 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 KiB

35
tests/test_cli_orphans.py Normal file
View File

@@ -0,0 +1,35 @@
"""Test `osxphotos orphan` CLI"""
import os.path
from click.testing import CliRunner
from osxphotos.cli.orphans import orphans
from .test_cli import PHOTOS_DB_15_7
def test_orphans():
"""test basic orphans"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
orphans, ["--db", os.path.join(cwd, PHOTOS_DB_15_7), "-V"]
)
assert result.exit_code == 0
assert "Found 1 orphan" in result.output
def test_orphans_export():
"""test export of orphans"""
runner = CliRunner()
cwd = os.getcwd()
# pylint: disable=not-context-manager
with runner.isolated_filesystem():
result = runner.invoke(
orphans, ["--db", os.path.join(cwd, PHOTOS_DB_15_7), "--export", ".", "-V"]
)
assert result.exit_code == 0
assert "Exported 1 file" in result.output