added intrash support for issue #179

This commit is contained in:
Rhet Turnbull
2020-06-27 10:54:25 -07:00
parent c1d12047bd
commit 185483e1aa
28 changed files with 180 additions and 32 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

View File

@@ -5,6 +5,6 @@
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
<date>2020-04-25T23:54:43Z</date>
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
<date>2020-04-26T06:26:10Z</date>
<date>2020-06-27T16:03:48Z</date>
</dict>
</plist>

View File

@@ -11,6 +11,6 @@
<key>PLLastRevGeoForcedProviderOutOfDateCheckVersionKey</key>
<integer>1</integer>
<key>PLLastRevGeoVerFileFetchDateKey</key>
<date>2020-04-25T23:54:29Z</date>
<date>2020-06-27T16:03:43Z</date>
</dict>
</plist>

View File

@@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>LastHistoryRowId</key>
<integer>606</integer>
<integer>651</integer>
<key>LibraryBuildTag</key>
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
<key>LibrarySchemaVersion</key>

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

View File

@@ -24,7 +24,7 @@
<key>SnapshotCompletedDate</key>
<date>2019-07-27T13:16:43Z</date>
<key>SnapshotLastValidated</key>
<date>2020-04-25T23:56:35Z</date>
<date>2020-06-27T16:03:33Z</date>
<key>SnapshotTables</key>
<dict/>
</dict>

View File

@@ -7,7 +7,9 @@ PHOTOS_DB = "tests/Test-10.15.5.photoslibrary/database/photos.db"
PHOTOS_DB_PATH = "/Test-10.15.5.photoslibrary/database/photos.db"
PHOTOS_LIBRARY_PATH = "/Test-10.15.5.photoslibrary"
PHOTOS_DB_LEN = 13
PHOTOS_DB_LEN = 14
PHOTOS_NOT_IN_TRASH_LEN = 13
PHOTOS_IN_TRASH_LEN = 1
KEYWORDS = [
"Kids",
@@ -67,6 +69,8 @@ UUID_DICT = {
"export_tif": "8846E3E6-8AC8-4857-8448-E3D025784410",
"in_album": "D79B8D77-BFFC-460B-9312-034F2877D35B", # "Pumkins2.jpg"
"date_invalid": "8846E3E6-8AC8-4857-8448-E3D025784410",
"intrash": "71E3E212-00EB-430D-8A63-5E294B268554",
"not_intrash": "DC99FBDD-7A52-4100-A5BB-344131646C30",
}
UUID_PUMPKIN_FARM = [
@@ -393,7 +397,63 @@ def test_count():
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos()
assert len(photos) == PHOTOS_DB_LEN
assert len(photos) == PHOTOS_NOT_IN_TRASH_LEN
def test_photos_intrash_1():
""" test PhotosDB.photos(intrash=True) """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(intrash=True)
assert len(photos) == PHOTOS_IN_TRASH_LEN
def test_photos_intrash_2():
""" test PhotosDB.photos(intrash=True) """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(intrash=True)
for p in photos:
assert p.intrash
def test_photos_intrash_2():
""" test PhotosDB.photos(intrash=False) """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(intrash=False)
for p in photos:
assert not p.intrash
def test_photoinfo_intrash_1():
""" Test PhotoInfo.intrash """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
p = photosdb.photos(uuid=[UUID_DICT["intrash"]], intrash=True)[0]
assert p.intrash
def test_photoinfo_intrash_2():
""" Test PhotoInfo.intrash and intrash=default"""
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
p = photosdb.photos(uuid=[UUID_DICT["intrash"]])
assert not p
def test_photoinfo_not_intrash():
""" Test PhotoInfo.intrash """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
p = photosdb.photos(uuid=[UUID_DICT["not_intrash"]])[0]
assert not p.intrash
def test_keyword_2():

View File

@@ -42,8 +42,14 @@ UUID_DICT = {
"favorite": "6bxcNnzRQKGnK4uPrCJ9UQ",
"not_favorite": "8SOE9s0XQVGsuq4ONohTng",
"date_invalid": "YZFCPY24TUySvpu7owiqxA",
"intrash": "3tljdX43R8+k6peNHVrJNQ",
"not_intrash": "6bxcNnzRQKGnK4uPrCJ9UQ",
}
PHOTOS_DB_LEN = 8
PHOTOS_NOT_IN_TRASH_LEN = 7
PHOTOS_IN_TRASH_LEN = 1
def test_init():
import osxphotos
@@ -65,7 +71,7 @@ def test_db_len():
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
# assert photosdb.db_version in osxphotos._TESTED_DB_VERSIONS
assert len(photosdb) == 7
assert len(photosdb) == PHOTOS_DB_LEN
def test_os_version():
@@ -309,7 +315,63 @@ def test_count():
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos()
assert len(photos) == 7
assert len(photos) == PHOTOS_NOT_IN_TRASH_LEN
def test_photos_intrash_1():
""" test PhotosDB.photos(intrash=True) """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(intrash=True)
assert len(photos) == PHOTOS_IN_TRASH_LEN
def test_photos_intrash_2():
""" test PhotosDB.photos(intrash=True) """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(intrash=True)
for p in photos:
assert p.intrash
def test_photos_intrash_2():
""" test PhotosDB.photos(intrash=False) """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos(intrash=False)
for p in photos:
assert not p.intrash
def test_photoinfo_intrash_1():
""" Test PhotoInfo.intrash """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
p = photosdb.photos(uuid=[UUID_DICT["intrash"]], intrash=True)[0]
assert p.intrash
def test_photoinfo_intrash_2():
""" Test PhotoInfo.intrash and intrash=default"""
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
p = photosdb.photos(uuid=[UUID_DICT["intrash"]])
assert not p
def test_photoinfo_not_intrash():
""" Test PhotoInfo.intrash """
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
p = photosdb.photos(uuid=[UUID_DICT["not_intrash"]])[0]
assert not p.intrash
def test_keyword_2():