Added media type specials, closes #60

This commit is contained in:
Rhet Turnbull
2020-03-08 12:52:44 -07:00
parent 1f8fd6e929
commit 15d7ad538d
8 changed files with 372 additions and 21 deletions

View File

@@ -0,0 +1,94 @@
# Test cloud photos
import pytest
PHOTOS_DB_CLOUD = "./tests/Test-Cloud-10.15.1.photoslibrary/database/photos.db"
UUID_DICT = {
"portrait": "7CDA5F84-AA16-4D28-9AA6-A49E1DF8A332",
"hdr": "D11D25FF-5F31-47D2-ABA9-58418878DC15",
"selfie": "080525C4-1F05-48E5-A3F4-0C53127BB39C",
"time_lapse": "4614086E-C797-4876-B3B9-3057E8D757C9",
"panorama": "1C1C8F1F-826B-4A24-B1CB-56628946A834",
"no_specials": "C2BBC7A4-5333-46EE-BAF0-093E72111B39",
}
def test_portrait():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["portrait"]])
assert photos[0].portrait
assert not photos[0].hdr
assert not photos[0].selfie
assert not photos[0].time_lapse
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].portrait
def test_hdr():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["hdr"]])
assert photos[0].hdr
assert not photos[0].portrait
assert not photos[0].selfie
assert not photos[0].time_lapse
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].hdr
def test_selfie():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["selfie"]])
assert photos[0].selfie
assert not photos[0].portrait
assert not photos[0].hdr
assert not photos[0].time_lapse
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].selfie
def test_time_lapse():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["time_lapse"]], movies=True)
assert photos[0].time_lapse
assert not photos[0].portrait
assert not photos[0].hdr
assert not photos[0].selfie
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].time_lapse
def test_panorama():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["panorama"]])
assert photos[0].panorama
assert not photos[0].portrait
assert not photos[0].selfie
assert not photos[0].time_lapse
assert not photos[0].hdr
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].panorama

View File

@@ -0,0 +1,96 @@
# Test cloud photos
import pytest
PHOTOS_DB_CLOUD = "./tests/Test-Cloud-10.14.6.photoslibrary/database/photos.db"
UUID_DICT = {
# "portrait": "7CDA5F84-AA16-4D28-9AA6-A49E1DF8A332",
"hdr": "UIgouj2cQqyKJnB2bCHrSg",
"selfie": "NsO5Yg8qSPGBGiVxsCd5Kw",
"time_lapse": "pKAWFwtlQYuR962KEaonPA",
# "panorama": "1C1C8F1F-826B-4A24-B1CB-56628946A834",
"no_specials": "%PgMNP%xRTWTJF+oOyZbXQ",
}
@pytest.mark.skip(reason="don't have portrait photo in the 10.14.6yy database")
def test_portrait():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["portrait"]])
assert photos[0].portrait
assert not photos[0].hdr
assert not photos[0].selfie
assert not photos[0].time_lapse
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].portrait
def test_hdr():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["hdr"]])
assert photos[0].hdr
assert not photos[0].portrait
assert not photos[0].selfie
assert not photos[0].time_lapse
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].hdr
def test_selfie():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["selfie"]])
assert photos[0].selfie
assert not photos[0].portrait
assert not photos[0].hdr
assert not photos[0].time_lapse
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].selfie
def test_time_lapse():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["time_lapse"]], movies=True)
assert photos[0].time_lapse
assert not photos[0].portrait
assert not photos[0].hdr
assert not photos[0].selfie
assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].time_lapse
@pytest.mark.skip(reason="no panorama in 10.14.6 database")
def test_panorama():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB_CLOUD)
photos = photosdb.photos(uuid=[UUID_DICT["panorama"]])
assert photos[0].panorama
assert not photos[0].portrait
assert not photos[0].selfie
assert not photos[0].time_lapse
assert not photos[0].hdr
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].panorama

View File

@@ -0,0 +1,87 @@
# Test cloud photos
import pytest
PHOTOS_DB = "./tests/Test-10.12.6.photoslibrary/database/photos.db"
UUID_DICT = {"no_specials": "Pj99JmYjQkeezdY2OFuSaw"}
def test_portrait():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB)
# photos = photosdb.photos(uuid=[UUID_DICT["portrait"]])
# assert photos[0].portrait
# assert not photos[0].hdr
# assert not photos[0].selfie
# assert not photos[0].time_lapse
# assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].portrait
def test_hdr():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB)
# photos = photosdb.photos(uuid=[UUID_DICT["hdr"]])
# assert photos[0].hdr
# assert not photos[0].portrait
# assert not photos[0].selfie
# assert not photos[0].time_lapse
# assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].hdr
def test_selfie():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB)
# photos = photosdb.photos(uuid=[UUID_DICT["selfie"]])
# assert photos[0].selfie
# assert not photos[0].portrait
# assert not photos[0].hdr
# assert not photos[0].time_lapse
# assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert photos[0].selfie is None
def test_time_lapse():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB)
# photos = photosdb.photos(uuid=[UUID_DICT["time_lapse"]], movies=True)
# assert photos[0].time_lapse
# assert not photos[0].portrait
# assert not photos[0].hdr
# assert not photos[0].selfie
# assert not photos[0].panorama
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].time_lapse
def test_panorama():
import osxphotos
photosdb = osxphotos.PhotosDB(PHOTOS_DB)
# photos = photosdb.photos(uuid=[UUID_DICT["panorama"]])
# assert photos[0].panorama
# assert not photos[0].portrait
# assert not photos[0].selfie
# assert not photos[0].time_lapse
# assert not photos[0].hdr
photos = photosdb.photos(uuid=[UUID_DICT["no_specials"]])
assert not photos[0].panorama