mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
ebf5f5d418
- use simpler pattern for migration dependencies - move SqliteDatabase & migration to utility method `init_db`, use this in both the app and tests, ensuring the same db schema is used in both
17 lines
607 B
Python
17 lines
607 B
Python
from logging import Logger
|
|
from unittest import mock
|
|
|
|
from invokeai.app.services.config.config_default import InvokeAIAppConfig
|
|
from invokeai.app.services.image_files.image_files_base import ImageFileStorageBase
|
|
from invokeai.app.services.shared.sqlite.sqlite_database import SqliteDatabase
|
|
from invokeai.app.services.shared.sqlite.sqlite_util import init_db
|
|
|
|
|
|
def create_mock_sqlite_database(
|
|
config: InvokeAIAppConfig,
|
|
logger: Logger,
|
|
) -> SqliteDatabase:
|
|
image_files = mock.Mock(spec=ImageFileStorageBase)
|
|
db = init_db(config=config, logger=logger, image_files=image_files)
|
|
return db
|