mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
Add the TestingConfiguration to simplify the testing configuration.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from .user_data_paths import UserDataPaths
|
||||
from .current_configuration import CurrentConfiguration
|
||||
from .configuration import Configuration
|
||||
from .testing_configuration import TestingConfiguration
|
||||
|
||||
__all__ = ['UserDataPaths', 'CurrentConfiguration', 'Configuration']
|
||||
__all__ = ['UserDataPaths', 'CurrentConfiguration', 'Configuration', 'TestingConfiguration']
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from injector import singleton, inject, Injector, Module, provider
|
||||
from injector import singleton, Module, provider
|
||||
|
||||
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupBackupPlansCommand
|
||||
from tui_rsync.core.components.backup_plan.application.queries import GetAllBackupBackupPlansQuery
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
from injector import singleton, Module, provider
|
||||
|
||||
from tui_rsync.core.components.backup_plan.application.commands import RemoveAllBackupBackupPlansCommand
|
||||
from tui_rsync.core.components.backup_plan.application.queries import GetAllBackupBackupPlansQuery
|
||||
from tui_rsync.core.components.backup_plan.application.repository import BackupPlanRepositoryPort
|
||||
from tui_rsync.core.components.backup_plan.application.repository.backup_plan_repository import BackupPlanRepository
|
||||
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
|
||||
from tui_rsync.core.ports.configuration import UserDataPathsPort
|
||||
from tui_rsync.core.ports.orm import DatabaseManagerPort
|
||||
from tui_rsync.core.shared_kernel.components.backup.application.service import BackupSyncService
|
||||
from tui_rsync.core.shared_kernel.components.backup.application.service.backup_restore_service import \
|
||||
BackupRestoreService
|
||||
from tui_rsync.infrastructure.configuration import UserDataPaths
|
||||
from tui_rsync.infrastructure.orm import InMemoryDatabaseManager
|
||||
from tui_rsync.user_interface.cli.shared_kernel.components.prompts.applications.prompts import ChoosePromptFzf
|
||||
|
||||
|
||||
class TestingConfiguration(Module):
|
||||
@provider
|
||||
@singleton
|
||||
def provide_user_data_paths(self) -> UserDataPathsPort:
|
||||
return UserDataPaths()
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_database_manager(self) -> DatabaseManagerPort:
|
||||
return InMemoryDatabaseManager()
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_backup_plan_repository(self, database_manager: DatabaseManagerPort) -> BackupPlanRepositoryPort:
|
||||
return BackupPlanRepository(database_manager)
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_backup_plan_service(self, backup_plan_repository: BackupPlanRepositoryPort) -> BackupPlanService:
|
||||
return BackupPlanService(backup_plan_repository)
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_remove_all_backup_backup_plans_command(self, database_manager: DatabaseManagerPort) -> RemoveAllBackupBackupPlansCommand:
|
||||
return RemoveAllBackupBackupPlansCommand(database_manager)
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_get_all_backup_backup_plans_query(self, database_manager: DatabaseManagerPort) -> GetAllBackupBackupPlansQuery:
|
||||
return GetAllBackupBackupPlansQuery(database_manager)
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_backup_sync_service(self, backup_plan_repository: BackupPlanRepositoryPort) -> BackupSyncService:
|
||||
return BackupSyncService(backup_plan_repository)
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_backup_restore_service(self, backup_plan_repository: BackupPlanRepositoryPort) -> BackupRestoreService:
|
||||
return BackupRestoreService(backup_plan_repository)
|
||||
|
||||
@provider
|
||||
@singleton
|
||||
def provide_choose_prompt_fzf(self) -> ChoosePromptFzf:
|
||||
return ChoosePromptFzf()
|
||||
Reference in New Issue
Block a user