Implemented #731, export_id in report database
This commit is contained in:
30
tests/test_sqlite_utils.py
Normal file
30
tests/test_sqlite_utils.py
Normal file
@@ -0,0 +1,30 @@
|
||||
"""Tests for sqlite_utils """
|
||||
|
||||
import pytest
|
||||
import sqlite3
|
||||
|
||||
from osxphotos.sqlite_utils import sqlite_open_ro, sqlite_db_is_locked
|
||||
|
||||
|
||||
DB_LOCKED_10_12 = "./tests/Test-Lock-10_12.photoslibrary/database/photos.db"
|
||||
DB_LOCKED_10_15 = "./tests/Test-Lock-10_15_1.photoslibrary/database/Photos.sqlite"
|
||||
DB_UNLOCKED_10_15 = "./tests/Test-10.15.1.photoslibrary/database/photos.db"
|
||||
|
||||
|
||||
def test_db_is_locked_locked():
|
||||
|
||||
assert sqlite_db_is_locked(DB_LOCKED_10_12)
|
||||
assert sqlite_db_is_locked(DB_LOCKED_10_15)
|
||||
|
||||
|
||||
def test_db_is_locked_unlocked():
|
||||
|
||||
assert not sqlite_db_is_locked(DB_UNLOCKED_10_15)
|
||||
|
||||
|
||||
def test_open_sqlite_ro():
|
||||
|
||||
conn, cur = sqlite_open_ro(DB_UNLOCKED_10_15)
|
||||
assert isinstance(conn, sqlite3.Connection)
|
||||
assert isinstance(cur, sqlite3.Cursor)
|
||||
conn.close()
|
||||
@@ -1,5 +1,5 @@
|
||||
import logging
|
||||
import os.path
|
||||
"""Test osxphotos.utils"""
|
||||
|
||||
import pathlib
|
||||
import tempfile
|
||||
|
||||
@@ -7,16 +7,12 @@ import pytest
|
||||
|
||||
import osxphotos
|
||||
|
||||
DB_LOCKED_10_12 = "./tests/Test-Lock-10_12.photoslibrary/database/photos.db"
|
||||
DB_LOCKED_10_15 = "./tests/Test-Lock-10_15_1.photoslibrary/database/Photos.sqlite"
|
||||
DB_UNLOCKED_10_15 = "./tests/Test-10.15.1.photoslibrary/database/photos.db"
|
||||
|
||||
UTI_DICT = {"public.jpeg": "jpeg", "com.canon.cr2-raw-image": "cr2"}
|
||||
|
||||
from osxphotos.utils import (
|
||||
_dd_to_dms,
|
||||
increment_filename_with_count,
|
||||
increment_filename,
|
||||
increment_filename_with_count,
|
||||
list_directory,
|
||||
shortuuid_to_uuid,
|
||||
uuid_to_shortuuid,
|
||||
@@ -39,17 +35,6 @@ def test_get_system_library_path():
|
||||
assert osxphotos.utils.get_system_library_path() is not None
|
||||
|
||||
|
||||
def test_db_is_locked_locked():
|
||||
|
||||
assert osxphotos.utils._db_is_locked(DB_LOCKED_10_12)
|
||||
assert osxphotos.utils._db_is_locked(DB_LOCKED_10_15)
|
||||
|
||||
|
||||
def test_db_is_locked_unlocked():
|
||||
|
||||
assert not osxphotos.utils._db_is_locked(DB_UNLOCKED_10_15)
|
||||
|
||||
|
||||
def test_list_directory():
|
||||
"""test list_directory"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user