Fixed tests for ubuntu

This commit is contained in:
Rhet Turnbull 2023-05-07 07:25:48 -07:00
parent 253901281d
commit ee8053d867

View File

@ -37,16 +37,19 @@ from osxphotos.cli import (
from osxphotos.exiftool import ExifTool, get_exiftool_path from osxphotos.exiftool import ExifTool, get_exiftool_path
from osxphotos.fileutil import FileUtil from osxphotos.fileutil import FileUtil
from osxphotos.utils import is_macos, noop, normalize_fs_path, normalize_unicode from osxphotos.utils import is_macos, noop, normalize_fs_path, normalize_unicode
if is_macos: if is_macos:
from osxmetadata import OSXMetaData, Tag from osxmetadata import OSXMetaData, Tag
from .conftest import copy_photos_library_to_path from .conftest import copy_photos_library_to_path
from .locale_util import setlocale from .locale_util import setlocale
def _normalize_fs_paths(paths): def _normalize_fs_paths(paths):
"""Small helper to prepare path strings for test""" """Small helper to prepare path strings for test"""
return [normalize_fs_path(p) for p in paths] return [normalize_fs_path(p) for p in paths]
CLI_PHOTOS_DB = "tests/Test-10.15.7.photoslibrary" CLI_PHOTOS_DB = "tests/Test-10.15.7.photoslibrary"
LIVE_PHOTOS_DB = "tests/Test-Cloud-10.15.1.photoslibrary" LIVE_PHOTOS_DB = "tests/Test-Cloud-10.15.1.photoslibrary"
RAW_PHOTOS_DB = "tests/Test-RAW-10.15.1.photoslibrary" RAW_PHOTOS_DB = "tests/Test-RAW-10.15.1.photoslibrary"
@ -73,7 +76,8 @@ SKIP_UUID_FILE = "tests/skip_uuid_from_file.txt"
CLI_OUTPUT_QUERY_UUID = '[{"uuid": "D79B8D77-BFFC-460B-9312-034F2877D35B", "filename": "D79B8D77-BFFC-460B-9312-034F2877D35B.jpeg", "original_filename": "Pumkins2.jpg", "date": "2018-09-28T16:07:07-04:00", "description": "Girl holding pumpkin", "title": "I found one!", "keywords": ["Kids"], "albums": ["Pumpkin Farm", "Test Album", "Multi Keyword"], "persons": ["Katie"], "path": "/tests/Test-10.15.7.photoslibrary/originals/D/D79B8D77-BFFC-460B-9312-034F2877D35B.jpeg", "ismissing": false, "hasadjustments": false, "external_edit": false, "favorite": false, "hidden": false, "latitude": 41.256566, "longitude": -95.940257, "path_edited": null, "shared": false, "isphoto": true, "ismovie": false, "uti": "public.jpeg", "burst": false, "live_photo": false, "path_live_photo": null, "iscloudasset": false, "incloud": null}]' CLI_OUTPUT_QUERY_UUID = '[{"uuid": "D79B8D77-BFFC-460B-9312-034F2877D35B", "filename": "D79B8D77-BFFC-460B-9312-034F2877D35B.jpeg", "original_filename": "Pumkins2.jpg", "date": "2018-09-28T16:07:07-04:00", "description": "Girl holding pumpkin", "title": "I found one!", "keywords": ["Kids"], "albums": ["Pumpkin Farm", "Test Album", "Multi Keyword"], "persons": ["Katie"], "path": "/tests/Test-10.15.7.photoslibrary/originals/D/D79B8D77-BFFC-460B-9312-034F2877D35B.jpeg", "ismissing": false, "hasadjustments": false, "external_edit": false, "favorite": false, "hidden": false, "latitude": 41.256566, "longitude": -95.940257, "path_edited": null, "shared": false, "isphoto": true, "ismovie": false, "uti": "public.jpeg", "burst": false, "live_photo": false, "path_live_photo": null, "iscloudasset": false, "incloud": null}]'
CLI_EXPORT_FILENAMES = _normalize_fs_paths([ CLI_EXPORT_FILENAMES = _normalize_fs_paths(
[
"[2020-08-29] AAF035 (1).jpg", "[2020-08-29] AAF035 (1).jpg",
"[2020-08-29] AAF035 (2).jpg", "[2020-08-29] AAF035 (2).jpg",
"[2020-08-29] AAF035 (3).jpg", "[2020-08-29] AAF035 (3).jpg",
@ -107,10 +111,12 @@ CLI_EXPORT_FILENAMES = _normalize_fs_paths([
"wedding.jpg", "wedding.jpg",
"winebottle (1).jpeg", "winebottle (1).jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_FILENAMES_DRY_RUN = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_DRY_RUN = _normalize_fs_paths(
[
"[2020-08-29] AAF035.jpg", "[2020-08-29] AAF035.jpg",
"DSC03584.dng", "DSC03584.dng",
"Frítest_edited.jpeg", "Frítest_edited.jpeg",
@ -137,25 +143,22 @@ CLI_EXPORT_FILENAMES_DRY_RUN = _normalize_fs_paths([
"wedding.jpg", "wedding.jpg",
"winebottle.jpeg", "winebottle.jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_IGNORE_SIGNATURE_FILENAMES = _normalize_fs_paths([ CLI_EXPORT_IGNORE_SIGNATURE_FILENAMES = _normalize_fs_paths(
"Tulips.jpg", ["Tulips.jpg", "wedding.jpg"]
"wedding.jpg" )
])
CLI_EXPORT_FILENAMES_ALBUM = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_ALBUM = _normalize_fs_paths(
"Pumkins1.jpg", ["Pumkins1.jpg", "Pumkins2.jpg", "Pumpkins3.jpg"]
"Pumkins2.jpg", )
"Pumpkins3.jpg"
])
CLI_EXPORT_FILENAMES_ALBUM_UNICODE = _normalize_fs_paths(["IMG_4547.jpg"]) CLI_EXPORT_FILENAMES_ALBUM_UNICODE = _normalize_fs_paths(["IMG_4547.jpg"])
CLI_EXPORT_FILENAMES_DELETED_TWIN = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_DELETED_TWIN = _normalize_fs_paths(
"wedding.jpg", ["wedding.jpg", "wedding_edited.jpeg"]
"wedding_edited.jpeg" )
])
CLI_EXPORT_EDITED_SUFFIX = "_bearbeiten" CLI_EXPORT_EDITED_SUFFIX = "_bearbeiten"
CLI_EXPORT_EDITED_SUFFIX_TEMPLATE = "{edited?_edited,}" CLI_EXPORT_EDITED_SUFFIX_TEMPLATE = "{edited?_edited,}"
@ -163,7 +166,8 @@ CLI_EXPORT_ORIGINAL_SUFFIX = "_original"
CLI_EXPORT_ORIGINAL_SUFFIX_TEMPLATE = "{edited?_original,}" CLI_EXPORT_ORIGINAL_SUFFIX_TEMPLATE = "{edited?_original,}"
CLI_EXPORT_PREVIEW_SUFFIX = "_lowres" CLI_EXPORT_PREVIEW_SUFFIX = "_lowres"
CLI_EXPORT_FILENAMES_EDITED_SUFFIX = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_EDITED_SUFFIX = _normalize_fs_paths(
[
"[2020-08-29] AAF035 (1).jpg", "[2020-08-29] AAF035 (1).jpg",
"[2020-08-29] AAF035 (2).jpg", "[2020-08-29] AAF035 (2).jpg",
"[2020-08-29] AAF035 (3).jpg", "[2020-08-29] AAF035 (3).jpg",
@ -197,9 +201,11 @@ CLI_EXPORT_FILENAMES_EDITED_SUFFIX = _normalize_fs_paths([
"wedding.jpg", "wedding.jpg",
"winebottle (1).jpeg", "winebottle (1).jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_FILENAMES_EDITED_SUFFIX_TEMPLATE = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_EDITED_SUFFIX_TEMPLATE = _normalize_fs_paths(
[
"[2020-08-29] AAF035 (1).jpg", "[2020-08-29] AAF035 (1).jpg",
"[2020-08-29] AAF035 (2).jpg", "[2020-08-29] AAF035 (2).jpg",
"[2020-08-29] AAF035 (3).jpg", "[2020-08-29] AAF035 (3).jpg",
@ -233,9 +239,11 @@ CLI_EXPORT_FILENAMES_EDITED_SUFFIX_TEMPLATE = _normalize_fs_paths([
"wedding.jpg", "wedding.jpg",
"winebottle (1).jpeg", "winebottle (1).jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX = _normalize_fs_paths(
[
"[2020-08-29] AAF035_original (1).jpg", "[2020-08-29] AAF035_original (1).jpg",
"[2020-08-29] AAF035_original (2).jpg", "[2020-08-29] AAF035_original (2).jpg",
"[2020-08-29] AAF035_original (3).jpg", "[2020-08-29] AAF035_original (3).jpg",
@ -269,9 +277,11 @@ CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX = _normalize_fs_paths([
"wedding_original.jpg", "wedding_original.jpg",
"winebottle_original (1).jpeg", "winebottle_original (1).jpeg",
"winebottle_original.jpeg", "winebottle_original.jpeg",
]) ]
)
CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE = _normalize_fs_paths(
[
"[2020-08-29] AAF035 (1).jpg", "[2020-08-29] AAF035 (1).jpg",
"[2020-08-29] AAF035 (2).jpg", "[2020-08-29] AAF035 (2).jpg",
"[2020-08-29] AAF035 (3).jpg", "[2020-08-29] AAF035 (3).jpg",
@ -305,7 +315,8 @@ CLI_EXPORT_FILENAMES_ORIGINAL_SUFFIX_TEMPLATE = _normalize_fs_paths([
"wedding_original.jpg", "wedding_original.jpg",
"winebottle (1).jpeg", "winebottle (1).jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_FILENAMES_CURRENT = [ CLI_EXPORT_FILENAMES_CURRENT = [
"1793FAAB-DE75-4E25-886C-2BD66C780D6A_edited.jpeg", # Frítest.jpg "1793FAAB-DE75-4E25-886C-2BD66C780D6A_edited.jpeg", # Frítest.jpg
@ -343,7 +354,8 @@ CLI_EXPORT_FILENAMES_CURRENT = [
"F207D5DE-EFAD-4217-8424-0764AAC971D0.jpeg", "F207D5DE-EFAD-4217-8424-0764AAC971D0.jpeg",
] ]
CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG = _normalize_fs_paths(
[
"[2020-08-29] AAF035 (1).jpg", "[2020-08-29] AAF035 (1).jpg",
"[2020-08-29] AAF035 (2).jpg", "[2020-08-29] AAF035 (2).jpg",
"[2020-08-29] AAF035 (3).jpg", "[2020-08-29] AAF035 (3).jpg",
@ -377,9 +389,11 @@ CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG = _normalize_fs_paths([
"wedding.jpg", "wedding.jpg",
"winebottle (1).jpeg", "winebottle (1).jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG_SKIP_RAW = _normalize_fs_paths([ CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG_SKIP_RAW = _normalize_fs_paths(
[
"[2020-08-29] AAF035 (1).jpg", "[2020-08-29] AAF035 (1).jpg",
"[2020-08-29] AAF035 (2).jpg", "[2020-08-29] AAF035 (2).jpg",
"[2020-08-29] AAF035 (3).jpg", "[2020-08-29] AAF035 (3).jpg",
@ -411,26 +425,32 @@ CLI_EXPORT_FILENAMES_CONVERT_TO_JPEG_SKIP_RAW = _normalize_fs_paths([
"wedding.jpg", "wedding.jpg",
"winebottle (1).jpeg", "winebottle (1).jpeg",
"winebottle.jpeg", "winebottle.jpeg",
]) ]
)
CLI_EXPORT_CONVERT_TO_JPEG_LARGE_FILE = "DSC03584.jpeg" CLI_EXPORT_CONVERT_TO_JPEG_LARGE_FILE = "DSC03584.jpeg"
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES1 = _normalize_fs_paths([ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES1 = _normalize_fs_paths(
[
"2019/April/wedding.jpg", "2019/April/wedding.jpg",
"2019/July/Tulips.jpg", "2019/July/Tulips.jpg",
"2018/October/St James Park.jpg", "2018/October/St James Park.jpg",
"2018/September/Pumpkins3.jpg", "2018/September/Pumpkins3.jpg",
"2018/September/Pumkins2.jpg", "2018/September/Pumkins2.jpg",
"2018/September/Pumkins1.jpg", "2018/September/Pumkins1.jpg",
]) ]
)
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_LOCALE = _normalize_fs_paths([ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_LOCALE = _normalize_fs_paths(
[
"2019/September/IMG_9975.JPEG", "2019/September/IMG_9975.JPEG",
"2020/Februar/IMG_1064.JPEG", "2020/Februar/IMG_1064.JPEG",
"2016/März/IMG_3984.JPEG", "2016/März/IMG_3984.JPEG",
]) ]
)
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_ALBUM1 = _normalize_fs_paths([ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_ALBUM1 = _normalize_fs_paths(
[
"Multi Keyword/wedding.jpg", "Multi Keyword/wedding.jpg",
"_/Tulips.jpg", "_/Tulips.jpg",
"_/St James Park.jpg", "_/St James Park.jpg",
@ -438,9 +458,11 @@ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_ALBUM1 = _normalize_fs_paths([
"Pumpkin Farm/Pumkins2.jpg", "Pumpkin Farm/Pumkins2.jpg",
"Pumpkin Farm/Pumkins1.jpg", "Pumpkin Farm/Pumkins1.jpg",
"Test Album/Pumkins1.jpg", "Test Album/Pumkins1.jpg",
]) ]
)
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_ALBUM2 = _normalize_fs_paths([ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_ALBUM2 = _normalize_fs_paths(
[
"Multi Keyword/wedding.jpg", "Multi Keyword/wedding.jpg",
"NOALBUM/Tulips.jpg", "NOALBUM/Tulips.jpg",
"NOALBUM/St James Park.jpg", "NOALBUM/St James Park.jpg",
@ -448,28 +470,34 @@ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES_ALBUM2 = _normalize_fs_paths([
"Pumpkin Farm/Pumkins2.jpg", "Pumpkin Farm/Pumkins2.jpg",
"Pumpkin Farm/Pumkins1.jpg", "Pumpkin Farm/Pumkins1.jpg",
"Test Album/Pumkins1.jpg", "Test Album/Pumkins1.jpg",
]) ]
)
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES2 = _normalize_fs_paths([ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES2 = _normalize_fs_paths(
[
"St James's Park, Great Britain, Westminster, England, United Kingdom/St James Park.jpg", "St James's Park, Great Britain, Westminster, England, United Kingdom/St James Park.jpg",
"_/Pumpkins3.jpg", "_/Pumpkins3.jpg",
"Omaha, Nebraska, United States/Pumkins2.jpg", "Omaha, Nebraska, United States/Pumkins2.jpg",
"_/Pumkins1.jpg", "_/Pumkins1.jpg",
"_/Tulips.jpg", "_/Tulips.jpg",
"_/wedding.jpg", "_/wedding.jpg",
]) ]
)
CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES3 = _normalize_fs_paths([ CLI_EXPORTED_DIRECTORY_TEMPLATE_FILENAMES3 = _normalize_fs_paths(
[
"2019/{foo}/wedding.jpg", "2019/{foo}/wedding.jpg",
"2019/{foo}/Tulips.jpg", "2019/{foo}/Tulips.jpg",
"2018/{foo}/St James Park.jpg", "2018/{foo}/St James Park.jpg",
"2018/{foo}/Pumpkins3.jpg", "2018/{foo}/Pumpkins3.jpg",
"2018/{foo}/Pumkins2.jpg", "2018/{foo}/Pumkins2.jpg",
"2018/{foo}/Pumkins1.jpg", "2018/{foo}/Pumkins1.jpg",
]) ]
)
CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES1 = _normalize_fs_paths([ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES1 = _normalize_fs_paths(
[
"2019-wedding.jpg", "2019-wedding.jpg",
"2019-wedding_edited.jpeg", "2019-wedding_edited.jpeg",
"2019-Tulips.jpg", "2019-Tulips.jpg",
@ -478,9 +506,11 @@ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES1 = _normalize_fs_paths([
"2018-Pumpkins3.jpg", "2018-Pumpkins3.jpg",
"2018-Pumkins2.jpg", "2018-Pumkins2.jpg",
"2018-Pumkins1.jpg", "2018-Pumkins1.jpg",
]) ]
)
CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES2 = _normalize_fs_paths([ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES2 = _normalize_fs_paths(
[
"Folder1_SubFolder2_AlbumInFolder-IMG_4547.jpg", "Folder1_SubFolder2_AlbumInFolder-IMG_4547.jpg",
"Folder1_SubFolder2_AlbumInFolder-wedding.jpg", "Folder1_SubFolder2_AlbumInFolder-wedding.jpg",
"Folder1_SubFolder2_AlbumInFolder-wedding_edited.jpeg", "Folder1_SubFolder2_AlbumInFolder-wedding_edited.jpeg",
@ -501,18 +531,21 @@ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES2 = _normalize_fs_paths([
"None-IMG_1693.tif", "None-IMG_1693.tif",
"I have a deleted twin-wedding.jpg", "I have a deleted twin-wedding.jpg",
"I have a deleted twin-wedding_edited.jpeg", "I have a deleted twin-wedding_edited.jpeg",
]) ]
)
CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES_PATHSEP = _normalize_fs_paths([ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES_PATHSEP = _normalize_fs_paths(
[
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum/IMG_4547.jpg", "2018-10 - Sponsion, Museum, Frühstück, Römermuseum/IMG_4547.jpg",
"Folder1/SubFolder2/AlbumInFolder/IMG_4547.jpg", "Folder1/SubFolder2/AlbumInFolder/IMG_4547.jpg",
"2019-10:11 Paris Clermont/IMG_4547.jpg", "2019-10:11 Paris Clermont/IMG_4547.jpg",
]) ]
)
CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES_KEYWORD_PATHSEP = _normalize_fs_paths([ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES_KEYWORD_PATHSEP = _normalize_fs_paths(
"foo:bar/foo:bar_IMG_3092.heic" ["foo:bar/foo:bar_IMG_3092.heic"]
]) )
CLI_EXPORTED_FILENAME_TEMPLATE_LONG_DESCRIPTION = [ CLI_EXPORTED_FILENAME_TEMPLATE_LONG_DESCRIPTION = [
"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo" "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo"
@ -536,40 +569,50 @@ CLI_EXPORT_BY_DATE_TOUCH_UUID = [
"F12384F6-CD17-4151-ACBA-AE0E3688539E", # Pumkins1.jpg "F12384F6-CD17-4151-ACBA-AE0E3688539E", # Pumkins1.jpg
] ]
CLI_EXPORT_BY_DATE_TOUCH_TIMES = [1538165373, 1538163349] CLI_EXPORT_BY_DATE_TOUCH_TIMES = [1538165373, 1538163349]
CLI_EXPORT_BY_DATE_NEED_TOUCH = _normalize_fs_paths([ CLI_EXPORT_BY_DATE_NEED_TOUCH = _normalize_fs_paths(
[
"2018/09/28/Pumkins2.jpg", "2018/09/28/Pumkins2.jpg",
"2018/10/13/St James Park.jpg", "2018/10/13/St James Park.jpg",
]) ]
)
CLI_EXPORT_BY_DATE_NEED_TOUCH_UUID = [ CLI_EXPORT_BY_DATE_NEED_TOUCH_UUID = [
"D79B8D77-BFFC-460B-9312-034F2877D35B", "D79B8D77-BFFC-460B-9312-034F2877D35B",
"DC99FBDD-7A52-4100-A5BB-344131646C30", "DC99FBDD-7A52-4100-A5BB-344131646C30",
] ]
CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES = [1538165227, 1539436692] CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES = [1538165227, 1539436692]
CLI_EXPORT_BY_DATE = _normalize_fs_paths([ CLI_EXPORT_BY_DATE = _normalize_fs_paths(
[
"2018/09/28/Pumpkins3.jpg", "2018/09/28/Pumpkins3.jpg",
"2018/09/28/Pumkins1.jpg", "2018/09/28/Pumkins1.jpg",
]) ]
)
CLI_EXPORT_SIDECAR_FILENAMES = _normalize_fs_paths([ CLI_EXPORT_SIDECAR_FILENAMES = _normalize_fs_paths(
[
"Pumkins2.jpg", "Pumkins2.jpg",
"Pumkins2.jpg.json", "Pumkins2.jpg.json",
"Pumkins2.jpg.xmp", "Pumkins2.jpg.xmp",
]) ]
CLI_EXPORT_SIDECAR_DROP_EXT_FILENAMES = _normalize_fs_paths([ )
CLI_EXPORT_SIDECAR_DROP_EXT_FILENAMES = _normalize_fs_paths(
[
"Pumkins2.jpg", "Pumkins2.jpg",
"Pumkins2.json", "Pumkins2.json",
"Pumkins2.xmp", "Pumkins2.xmp",
]) ]
)
CLI_EXPORT_LIVE = [ CLI_EXPORT_LIVE = [
"51F2BEF7-431A-4D31-8AC1-3284A57826AE.jpeg", "51F2BEF7-431A-4D31-8AC1-3284A57826AE.jpeg",
"51F2BEF7-431A-4D31-8AC1-3284A57826AE.mov", "51F2BEF7-431A-4D31-8AC1-3284A57826AE.mov",
] ]
CLI_EXPORT_LIVE_ORIGINAL = _normalize_fs_paths([ CLI_EXPORT_LIVE_ORIGINAL = _normalize_fs_paths(
[
"IMG_0728.JPG", "IMG_0728.JPG",
"IMG_0728.mov", "IMG_0728.mov",
]) ]
)
CLI_EXPORT_RAW = ["441DFE2A-A69B-4C79-A69B-3F51D1B9B29C.cr2"] CLI_EXPORT_RAW = ["441DFE2A-A69B-4C79-A69B-3F51D1B9B29C.cr2"]
CLI_EXPORT_RAW_ORIGINAL = _normalize_fs_paths(["IMG_0476_2.CR2"]) CLI_EXPORT_RAW_ORIGINAL = _normalize_fs_paths(["IMG_0476_2.CR2"])
@ -577,10 +620,12 @@ CLI_EXPORT_RAW_EDITED = [
"441DFE2A-A69B-4C79-A69B-3F51D1B9B29C.cr2", "441DFE2A-A69B-4C79-A69B-3F51D1B9B29C.cr2",
"441DFE2A-A69B-4C79-A69B-3F51D1B9B29C_edited.jpeg", "441DFE2A-A69B-4C79-A69B-3F51D1B9B29C_edited.jpeg",
] ]
CLI_EXPORT_RAW_EDITED_ORIGINAL = _normalize_fs_paths([ CLI_EXPORT_RAW_EDITED_ORIGINAL = _normalize_fs_paths(
[
"IMG_0476_2.CR2", "IMG_0476_2.CR2",
"IMG_0476_2_edited.jpeg", "IMG_0476_2_edited.jpeg",
]) ]
)
CLI_UUID_DICT_15_7 = { CLI_UUID_DICT_15_7 = {
"intrash": "71E3E212-00EB-430D-8A63-5E294B268554", "intrash": "71E3E212-00EB-430D-8A63-5E294B268554",
@ -990,12 +1035,14 @@ UUID_UNICODE_TITLE = [
"D1D4040D-D141-44E8-93EA-E403D9F63E07", # Frítest.jpg "D1D4040D-D141-44E8-93EA-E403D9F63E07", # Frítest.jpg
] ]
EXPORT_UNICODE_TITLE_FILENAMES = _normalize_fs_paths([ EXPORT_UNICODE_TITLE_FILENAMES = _normalize_fs_paths(
[
"Frítest.jpg", "Frítest.jpg",
"Frítest (1).jpg", "Frítest (1).jpg",
"Frítest (2).jpg", "Frítest (2).jpg",
"Frítest (3).jpg", "Frítest (3).jpg",
]) ]
)
# data for --report # data for --report
UUID_REPORT = [ UUID_REPORT = [
@ -1017,12 +1064,14 @@ QUERY_EXIF_DATA_CASE_INSENSITIVE = [
EXPORT_EXIF_DATA = [("EXIF:Make", "FUJIFILM", ["Tulips.jpg", "Tulips_edited.jpeg"])] EXPORT_EXIF_DATA = [("EXIF:Make", "FUJIFILM", ["Tulips.jpg", "Tulips_edited.jpeg"])]
UUID_LIVE_EDITED = "136A78FA-1B90-46CC-88A7-CCA3331F0353" # IMG_4813.HEIC UUID_LIVE_EDITED = "136A78FA-1B90-46CC-88A7-CCA3331F0353" # IMG_4813.HEIC
CLI_EXPORT_LIVE_EDITED = _normalize_fs_paths([ CLI_EXPORT_LIVE_EDITED = _normalize_fs_paths(
[
"IMG_4813.HEIC", "IMG_4813.HEIC",
"IMG_4813.mov", "IMG_4813.mov",
"IMG_4813_edited.jpeg", "IMG_4813_edited.jpeg",
"IMG_4813_edited.mov", "IMG_4813_edited.mov",
]) ]
)
UUID_FAVORITE = "E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51" UUID_FAVORITE = "E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51"
FILE_FAVORITE = "wedding.jpg" FILE_FAVORITE = "wedding.jpg"
@ -1103,7 +1152,6 @@ def setup_touch_tests():
def test_osxphotos(): def test_osxphotos():
runner = CliRunner() runner = CliRunner()
result = runner.invoke(cli_main, []) result = runner.invoke(cli_main, [])
@ -1149,7 +1197,6 @@ def test_about():
def test_query_uuid(): def test_query_uuid():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
result = runner.invoke( result = runner.invoke(
@ -1848,7 +1895,6 @@ def isolated_filesystem_here():
def test_export_as_hardlink(): def test_export_as_hardlink():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -1914,7 +1960,6 @@ def test_export_using_hardlinks_incompat_options():
def test_export_current_name(): def test_export_current_name():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -1928,7 +1973,6 @@ def test_export_current_name():
def test_export_skip_edited(): def test_export_skip_edited():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -1942,7 +1986,6 @@ def test_export_skip_edited():
def test_export_edited(): def test_export_edited():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -1959,7 +2002,6 @@ def test_export_edited():
def test_export_not_edited(): def test_export_not_edited():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -2013,7 +2055,6 @@ def test_export_skip_original_if_edited():
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed") @pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
def test_export_exiftool(): def test_export_exiftool():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -2225,7 +2266,6 @@ def test_export_exiftool_path_render_template():
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed") @pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
def test_export_exiftool_ignore_date_modified(): def test_export_exiftool_ignore_date_modified():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3436,7 +3476,6 @@ def test_export_sidecar_exiftool():
def test_export_sidecar_templates(): def test_export_sidecar_templates():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3661,7 +3700,6 @@ def test_export_sidecar_invalid():
def test_export_live(): def test_export_live():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3674,7 +3712,6 @@ def test_export_live():
def test_export_skip_live(): def test_export_skip_live():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3687,7 +3724,6 @@ def test_export_skip_live():
def test_export_raw(): def test_export_raw():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3721,7 +3757,6 @@ def test_export_raw():
def test_export_raw_original(): def test_export_raw_original():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3734,7 +3769,6 @@ def test_export_raw_original():
def test_export_raw_edited(): def test_export_raw_edited():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -3747,7 +3781,6 @@ def test_export_raw_edited():
def test_export_raw_edited_original(): def test_export_raw_edited_original():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -4279,7 +4312,6 @@ def test_export_exif(exiftag, exifvalue, files_expected):
def test_places(): def test_places():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -4495,7 +4527,6 @@ def test_no_folder_1_14():
def test_export_sidecar_keyword_template(): def test_export_sidecar_keyword_template():
runner = CliRunner() runner = CliRunner()
cwd = os.getcwd() cwd = os.getcwd()
# pylint: disable=not-context-manager # pylint: disable=not-context-manager
@ -5275,11 +5306,17 @@ def test_export_touch_files():
f"exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" f"exported: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}"
in result.output in result.output
) )
assert (
f"touched date: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-2}" # on macOS there are two files that have the correct date and these don't get touched
in result.output # on other platforms, all files get touched
touched_files = (
PHOTOS_NOT_IN_TRASH_LEN_15_7 + PHOTOS_EDITED_15_7 - 2
if is_macos
else PHOTOS_NOT_IN_TRASH_LEN_15_7 + PHOTOS_EDITED_15_7
) )
assert f"touched date: {touched_files}" in result.output
for fname, mtime in zip(CLI_EXPORT_BY_DATE, CLI_EXPORT_BY_DATE_TOUCH_TIMES): for fname, mtime in zip(CLI_EXPORT_BY_DATE, CLI_EXPORT_BY_DATE_TOUCH_TIMES):
st = os.stat(fname) st = os.stat(fname)
assert int(st.st_mtime) == int(mtime) assert int(st.st_mtime) == int(mtime)
@ -5353,11 +5390,17 @@ def test_export_touch_files_update():
f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}"
in result.output in result.output
) )
assert (
f"touched date: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-2}" # on macOS there are two files that have the correct date and these don't get touched
in result.output # on other platforms, all files get touched
touched_files = (
PHOTOS_NOT_IN_TRASH_LEN_15_7 + PHOTOS_EDITED_15_7 - 2
if is_macos
else PHOTOS_NOT_IN_TRASH_LEN_15_7 + PHOTOS_EDITED_15_7
) )
assert f"touched date: {touched_files}" in result.output
for fname, mtime in zip( for fname, mtime in zip(
CLI_EXPORT_BY_DATE_NEED_TOUCH, CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES CLI_EXPORT_BY_DATE_NEED_TOUCH, CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES
): ):
@ -5380,10 +5423,7 @@ def test_export_touch_files_update():
f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}" f"skipped: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7}"
in result.output in result.output
) )
assert ( assert f"touched date: {touched_files}" in result.output
f"touched date: {PHOTOS_NOT_IN_TRASH_LEN_15_7+PHOTOS_EDITED_15_7-2}"
in result.output
)
for fname, mtime in zip( for fname, mtime in zip(
CLI_EXPORT_BY_DATE_NEED_TOUCH, CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES CLI_EXPORT_BY_DATE_NEED_TOUCH, CLI_EXPORT_BY_DATE_NEED_TOUCH_TIMES