Export DB can now reside outside export directory, #568
This commit is contained in:
@@ -5610,7 +5610,7 @@ def test_export_ignore_signature_sidecar():
|
||||
|
||||
# change the sidecar data in export DB
|
||||
# should result in a new sidecar being exported but not the image itself
|
||||
exportdb = osxphotos.export_db.ExportDB("./.osxphotos_export.db")
|
||||
exportdb = osxphotos.export_db.ExportDB("./.osxphotos_export.db", ".")
|
||||
for filename in CLI_EXPORT_IGNORE_SIGNATURE_FILENAMES:
|
||||
exportdb.set_sidecar_for_file(f"{filename}.xmp", "FOO", (0, 1, 2))
|
||||
|
||||
@@ -6163,16 +6163,6 @@ def test_export_exportdb():
|
||||
in result.output
|
||||
)
|
||||
|
||||
# specify a path for exportdb, should generate error
|
||||
result = runner.invoke(
|
||||
export,
|
||||
[os.path.join(cwd, CLI_PHOTOS_DB), ".", "-V", "--exportdb", "./export.db"],
|
||||
)
|
||||
assert result.exit_code != 0
|
||||
assert (
|
||||
"Error: --exportdb must be specified as filename not path" in result.output
|
||||
)
|
||||
|
||||
|
||||
def test_export_finder_tag_keywords():
|
||||
"""test --finder-tag-keywords"""
|
||||
|
||||
@@ -22,7 +22,7 @@ def test_export_db():
|
||||
|
||||
tempdir = tempfile.TemporaryDirectory(prefix="osxphotos_")
|
||||
dbname = os.path.join(tempdir.name, ".osxphotos_export.db")
|
||||
db = ExportDB(dbname)
|
||||
db = ExportDB(dbname, tempdir.name)
|
||||
assert os.path.isfile(dbname)
|
||||
assert db.was_created
|
||||
assert not db.was_upgraded
|
||||
@@ -76,7 +76,7 @@ def test_export_db():
|
||||
|
||||
# close and re-open
|
||||
db.close()
|
||||
db = ExportDB(dbname)
|
||||
db = ExportDB(dbname, tempdir.name)
|
||||
assert not db.was_created
|
||||
assert db.get_uuid_for_file(filepath2) == "BAR-FOO"
|
||||
assert db.get_info_for_uuid("BAR-FOO") == INFO_DATA
|
||||
@@ -131,7 +131,7 @@ def test_export_db_no_op():
|
||||
|
||||
db.set_detected_text_for_uuid("FOO-BAR", json.dumps([["foo", 0.5]]))
|
||||
assert db.get_detected_text_for_uuid("FOO-BAR") is None
|
||||
|
||||
|
||||
# test set_data which sets all at the same time
|
||||
filepath2 = os.path.join(tempdir.name, "test2.jpg")
|
||||
db.set_data(
|
||||
@@ -171,7 +171,7 @@ def test_export_db_in_memory():
|
||||
|
||||
tempdir = tempfile.TemporaryDirectory(prefix="osxphotos_")
|
||||
dbname = os.path.join(tempdir.name, ".osxphotos_export.db")
|
||||
db = ExportDB(dbname)
|
||||
db = ExportDB(dbname, tempdir.name)
|
||||
assert os.path.isfile(dbname)
|
||||
|
||||
filepath = os.path.join(tempdir.name, "test.JPG")
|
||||
@@ -190,7 +190,7 @@ def test_export_db_in_memory():
|
||||
|
||||
db.close()
|
||||
|
||||
dbram = ExportDBInMemory(dbname)
|
||||
dbram = ExportDBInMemory(dbname, tempdir.name)
|
||||
assert not dbram.was_created
|
||||
assert not dbram.was_upgraded
|
||||
assert dbram.version == OSXPHOTOS_EXPORTDB_VERSION
|
||||
@@ -232,7 +232,7 @@ def test_export_db_in_memory():
|
||||
dbram.close()
|
||||
|
||||
# re-open on disk and verify no changes
|
||||
db = ExportDB(dbname)
|
||||
db = ExportDB(dbname, tempdir.name)
|
||||
assert db.get_uuid_for_file(filepath_lower) == "FOO-BAR"
|
||||
assert db.get_info_for_uuid("FOO-BAR") == INFO_DATA
|
||||
assert db.get_exifdata_for_file(filepath) == EXIF_DATA
|
||||
@@ -258,7 +258,9 @@ def test_export_db_in_memory_nofile():
|
||||
filepath = os.path.join(tempdir.name, "test.JPG")
|
||||
filepath_lower = os.path.join(tempdir.name, "test.jpg")
|
||||
|
||||
dbram = ExportDBInMemory(os.path.join(tempdir.name, "NOT_A_DATABASE_FILE.db"))
|
||||
dbram = ExportDBInMemory(
|
||||
os.path.join(tempdir.name, "NOT_A_DATABASE_FILE.db"), tempdir.name
|
||||
)
|
||||
assert dbram.was_created
|
||||
assert not dbram.was_upgraded
|
||||
assert dbram.version == OSXPHOTOS_EXPORTDB_VERSION
|
||||
|
||||
Reference in New Issue
Block a user