Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug in PhotosDB.__repr__ and added test for empty database
- Loading branch information
Showing
34 changed files
with
272 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/Empty-Library-4.0-3461.7.150.photoslibrary/database/DataModelVersion.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>DatabaseMinorVersion</key> | ||
<integer>1</integer> | ||
<key>DatabaseVersion</key> | ||
<integer>112</integer> | ||
<key>LastOpenMode</key> | ||
<integer>2</integer> | ||
<key>LibrarySchemaVersion</key> | ||
<integer>4025</integer> | ||
<key>MetaSchemaVersion</key> | ||
<integer>2</integer> | ||
<key>createDate</key> | ||
<date>2019-12-27T23:19:08Z</date> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+8 KB
tests/Empty-Library-4.0-3461.7.150.photoslibrary/database/RKAlbum_name.skindex
Binary file not shown.
Binary file added
BIN
+6 KB
tests/Empty-Library-4.0-3461.7.150.photoslibrary/database/RKMemory_title.skindex
Binary file not shown.
Binary file added
BIN
+6 KB
tests/Empty-Library-4.0-3461.7.150.photoslibrary/database/RKVersion_searchIndexText.skindex
Binary file not shown.
Binary file added
BIN
+48 KB
tests/Empty-Library-4.0-3461.7.150.photoslibrary/database/metaSchema.db
Binary file not shown.
Binary file not shown.
Empty file.
Empty file.
25 changes: 25 additions & 0 deletions
25
.../Empty-Library-4.0-3461.7.150.photoslibrary/private/com.apple.Photos/appPrivateData.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>Photos</key> | ||
<dict> | ||
<key>CollapsedSidebarSectionIdentifiers</key> | ||
<array/> | ||
<key>ExpandedSidebarItemIdentifiers</key> | ||
<array> | ||
<string>TopLevelAlbums</string> | ||
<string>TopLevelSlideshows</string> | ||
</array> | ||
<key>lastKnownItemCounts</key> | ||
<dict> | ||
<key>other</key> | ||
<integer>0</integer> | ||
<key>photos</key> | ||
<integer>0</integer> | ||
<key>videos</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
8 changes: 8 additions & 0 deletions
8
...brary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key> | ||
<date>2019-12-27T23:19:59Z</date> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+4 KB
...rivate/com.apple.photoanalysisd/GraphService/PhotosGraph/construction-photosgraph.graphdb
Binary file not shown.
Binary file added
BIN
+32 KB
...te/com.apple.photoanalysisd/GraphService/PhotosGraph/construction-photosgraph.graphdb-shm
Binary file not shown.
Empty file.
Binary file added
BIN
+4 KB
...library/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph-tmp.graphdb
Binary file not shown.
Binary file added
BIN
+64 KB
...otoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb
Binary file not shown.
Binary file added
BIN
+32 KB
...library/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb-shm
Binary file not shown.
Empty file.
Empty file.
14 changes: 14 additions & 0 deletions
14
tests/Empty-Library-4.0-3461.7.150.photoslibrary/resources/moments/analysismetadata.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>PLLanguageAndLocaleKey</key> | ||
<string>en-US:en_US</string> | ||
<key>PLLastGeoProviderIdKey</key> | ||
<string>7618</string> | ||
<key>PLLastLocationInfoFormatVer</key> | ||
<integer>12</integer> | ||
<key>PLLastRevGeoForcedProviderOutOfDateCheckVersionKey</key> | ||
<integer>1</integer> | ||
</dict> | ||
</plist> |
12 changes: 12 additions & 0 deletions
12
tests/Empty-Library-4.0-3461.7.150.photoslibrary/resources/moments/historicalmarker.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>LastHistoryRowId</key> | ||
<integer>53</integer> | ||
<key>LibraryBuildTag</key> | ||
<string>F176BAF5-4B7A-4878-83C4-4D4175F299BF</string> | ||
<key>LibrarySchemaVersion</key> | ||
<integer>4025</integer> | ||
</dict> | ||
</plist> |
Empty file.
31 changes: 31 additions & 0 deletions
31
tests/Empty-Library-4.0-3461.7.150.photoslibrary/resources/recovery/Info.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>DatabaseMinorVersion</key> | ||
<integer>1</integer> | ||
<key>DatabaseVersion</key> | ||
<integer>112</integer> | ||
<key>HistoricalMarker</key> | ||
<dict> | ||
<key>LastHistoryRowId</key> | ||
<integer>53</integer> | ||
<key>LibraryBuildTag</key> | ||
<string>F176BAF5-4B7A-4878-83C4-4D4175F299BF</string> | ||
<key>LibrarySchemaVersion</key> | ||
<integer>4025</integer> | ||
</dict> | ||
<key>LibrarySchemaVersion</key> | ||
<integer>4025</integer> | ||
<key>MetaSchemaVersion</key> | ||
<integer>2</integer> | ||
<key>SnapshotComplete</key> | ||
<true/> | ||
<key>SnapshotCompletedDate</key> | ||
<date>2019-12-27T23:19:08Z</date> | ||
<key>SnapshotLastValidated</key> | ||
<date>2019-12-27T23:19:08Z</date> | ||
<key>SnapshotTables</key> | ||
<dict/> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+1.31 KB
.../Empty-Library-4.0-3461.7.150.photoslibrary/resources/recovery/RKAdminData/0000000000.lij
Binary file not shown.
Binary file added
BIN
+36 KB
tests/Empty-Library-4.0-3461.7.150.photoslibrary/resources/recovery/RKAlbum/0000000000.lij
Binary file not shown.
Binary file added
BIN
+953 Bytes
...-Library-4.0-3461.7.150.photoslibrary/resources/recovery/RKCustomSortOrder/0000000000.lij
Binary file not shown.
Binary file added
BIN
+5.1 KB
tests/Empty-Library-4.0-3461.7.150.photoslibrary/resources/recovery/RKFolder/0000000000.lij
Binary file not shown.
Binary file added
BIN
+896 Bytes
tests/Empty-Library-4.0-3461.7.150.photoslibrary/resources/recovery/RKKeyword/0000000000.lij
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import pytest | ||
|
||
# test empty library | ||
|
||
PHOTOS_DB = "./tests/Empty-Library-4.0-3461.7.150.photoslibrary/database/photos.db" | ||
PHOTOS_DB_PATH = "/Empty-Library-4.0-3461.7.150.photoslibrary/database/photos.db" | ||
PHOTOS_LIBRARY_PATH = "/Empty-Library-4.0-3461.7.150.photoslibrary" | ||
|
||
KEYWORDS = [] | ||
PERSONS = [] | ||
ALBUMS = [] | ||
KEYWORDS_DICT = {} | ||
PERSONS_DICT = {} | ||
ALBUM_DICT = {} | ||
|
||
|
||
def test_init(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
assert isinstance(photosdb, osxphotos.PhotosDB) | ||
|
||
|
||
def test_db_version(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
assert photosdb.db_version in osxphotos._constants._TESTED_DB_VERSIONS | ||
assert photosdb.db_version == "4025" | ||
|
||
|
||
def test_os_version(): | ||
import osxphotos | ||
|
||
(_, major, _) = osxphotos.utils._get_os_version() | ||
assert major in osxphotos._constants._TESTED_OS_VERSIONS | ||
|
||
|
||
def test_persons(): | ||
import osxphotos | ||
import collections | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
assert photosdb.persons == [] | ||
|
||
|
||
def test_keywords(): | ||
import osxphotos | ||
import collections | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
assert photosdb.keywords == [] | ||
|
||
|
||
def test_albums(): | ||
import osxphotos | ||
import collections | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
assert photosdb.albums == [] | ||
|
||
|
||
def test_keywords_dict(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
keywords = photosdb.keywords_as_dict | ||
assert keywords == {} | ||
|
||
|
||
def test_persons_as_dict(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
persons = photosdb.persons_as_dict | ||
assert persons == {} | ||
|
||
|
||
def test_albums_as_dict(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
albums = photosdb.albums_as_dict | ||
assert albums == {} | ||
|
||
|
||
def test_count(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
photos = photosdb.photos() | ||
assert len(photos) == 0 | ||
|
||
|
||
def test_get_db_path(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
db_path = photosdb.db_path | ||
assert db_path.endswith(PHOTOS_DB_PATH) | ||
|
||
|
||
def test_get_library_path(): | ||
import osxphotos | ||
|
||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) | ||
lib_path = photosdb.library_path | ||
assert lib_path.endswith(PHOTOS_LIBRARY_PATH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters