Refactored photoinfo, photoexporter; #462

This commit is contained in:
Rhet Turnbull
2022-01-02 09:06:04 -08:00
parent c99cf5518d
commit a73dc72558
23 changed files with 2681 additions and 2604 deletions

View File

@@ -1,9 +1,11 @@
import json
import pathlib
import pytest
import json
import osxphotos
from osxphotos._constants import _UNKNOWN_PERSON
import pathlib
from osxphotos.photoexporter import PhotoExporter
PHOTOS_DB = "./tests/Test-10.14.6.photoslibrary/database/photos.db"
PHOTOS_DB_PATH = "/Test-10.14.6.photoslibrary/database/photos.db"
@@ -335,7 +337,7 @@ def test_exiftool_json_sidecar(photosdb):
with open(str(pathlib.Path(SIDECAR_DIR) / f"{uuid}.json"), "r") as fp:
json_expected = json.load(fp)[0]
json_got = photo._exiftool_json_sidecar()
json_got = PhotoExporter(photo)._exiftool_json_sidecar()
json_got = json.loads(json_got)[0]
assert json_got == json_expected
@@ -349,7 +351,7 @@ def test_xmp_sidecar(photosdb):
with open(pathlib.Path(SIDECAR_DIR) / f"{uuid}_ext.xmp") as fp:
xmp_expected = fp.read()
xmp_got = photo._xmp_sidecar(extension="jpg")
xmp_got = PhotoExporter(photo)._xmp_sidecar(extension="jpg")
assert xmp_got == xmp_expected
@@ -362,7 +364,7 @@ def test_xmp_sidecar_keyword_template(photosdb):
with open(pathlib.Path(SIDECAR_DIR) / f"{uuid}_keyword_template.xmp") as fp:
xmp_expected = fp.read()
xmp_got = photo._xmp_sidecar(
xmp_got = PhotoExporter(photo)._xmp_sidecar(
keyword_template=["{created.year}", "{folder_album}"], extension="jpg"
)