File diff suppressed because one or more lines are too long
@@ -22,6 +22,17 @@ PHOTOS_DB_TOUCH = PHOTOS_DB_15_6
|
||||
PHOTOS_DB_14_6 = "tests/Test-10.14.6.photoslibrary"
|
||||
PHOTOS_DB_MOVIES = "tests/Test-Movie-5_0.photoslibrary"
|
||||
|
||||
# my personal library which some tests require
|
||||
PHOTOS_DB_RHET = os.path.expanduser("~/Pictures/Photos Library.photoslibrary")
|
||||
UUID_BURST_ALBUM = "9F90DC00-AAAF-4A05-9A65-61FEEE0D67F2" # in my personal library
|
||||
BURST_ALBUM_FILES = [
|
||||
"IMG_9812.JPG",
|
||||
"IMG_9813.JPG",
|
||||
"IMG_9814.JPG",
|
||||
"IMG_9815.JPG",
|
||||
"IMG_9816.JPG",
|
||||
]
|
||||
|
||||
UUID_FILE = "tests/uuid_from_file.txt"
|
||||
|
||||
CLI_OUTPUT_NO_SUBCOMMAND = [
|
||||
@@ -5649,3 +5660,42 @@ def test_export_jpeg_ext_convert_to_jpeg_movie():
|
||||
assert f"{filename}.jpg".lower() not in files
|
||||
assert f"{filename}.{ext}".lower() in files
|
||||
assert f"{filename}_edited.{ext}".lower() in files
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
"OSXPHOTOS_TEST_EXPORT" not in os.environ,
|
||||
reason="Skip if not running on author's personal library.",
|
||||
)
|
||||
def test_export_burst_folder_album():
|
||||
""" test non-selected burst photos are exported with the album their key photo is in, issue #401 """
|
||||
import glob
|
||||
import os
|
||||
import os.path
|
||||
import pathlib
|
||||
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, PHOTOS_DB_RHET),
|
||||
".",
|
||||
"-V",
|
||||
"--directory",
|
||||
"{folder_album}",
|
||||
"--uuid",
|
||||
UUID_BURST_ALBUM,
|
||||
"--download-missing",
|
||||
"--use-photokit",
|
||||
],
|
||||
)
|
||||
assert result.exit_code == 0
|
||||
folder_album = pathlib.Path("TestBurst")
|
||||
assert folder_album.is_dir()
|
||||
for filename in BURST_ALBUM_FILES:
|
||||
path = folder_album / filename
|
||||
assert path.is_file()
|
||||
|
||||
|
||||
@@ -17,6 +17,34 @@ UUID_DICT = {
|
||||
"live": "BFF29EBD-22DF-4FCF-9817-317E7104EA50",
|
||||
}
|
||||
|
||||
UUID_BURSTS = {
|
||||
"9F90DC00-AAAF-4A05-9A65-61FEEE0D67F2": {
|
||||
"selected": True,
|
||||
"filename": "IMAGE_9812.JPG",
|
||||
"albums": ["TestBurst"],
|
||||
},
|
||||
"964F457D-5FFC-47B9-BEAD-56B0A83FEF63": {
|
||||
"selected": True,
|
||||
"filename": "IMG_9816.JPG",
|
||||
"albums": [],
|
||||
},
|
||||
"A385FA13-DF8E-482F-A8C5-970EDDF54C2F": {
|
||||
"selected": False,
|
||||
"filename": "IMG_9813.JPG",
|
||||
"albums": ["TestBurst", "TestBurst2"],
|
||||
},
|
||||
"38F8F30C-FF6D-49DA-8092-18497F1D6628": {
|
||||
"selected": True,
|
||||
"filename": "IMG_9814.JPG",
|
||||
"albums": ["TestBurst2"],
|
||||
},
|
||||
"E3863443-9EA8-417F-A90B-8F7086623DAD": {
|
||||
"selected": False,
|
||||
"filename": "IMG_9815.JPG",
|
||||
"albums": ["TestBurst", "TestBurst2"],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def photosdb():
|
||||
@@ -156,3 +184,13 @@ def test_export_edited_no_edit(photosdb):
|
||||
with pytest.raises(Exception) as e:
|
||||
assert photos[0].export(dest, use_photos_export=True, edited=True)
|
||||
assert e.type == ValueError
|
||||
|
||||
|
||||
def test_burst_albums(photosdb):
|
||||
"""Test burst_selected, burst_albums"""
|
||||
|
||||
for uuid in UUID_BURSTS:
|
||||
photo = photosdb.get_photo(uuid)
|
||||
assert photo.burst
|
||||
assert photo.burst_selected == UUID_BURSTS[uuid]["selected"]
|
||||
assert sorted(photo.burst_albums) == sorted(UUID_BURSTS[uuid]["albums"])
|
||||
|
||||
Reference in New Issue
Block a user