mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-20 05:37:43 +00:00
Add tests for the remove all backup plans service.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from behave import given, when, then
|
||||
import json
|
||||
|
||||
from tui_rsync.core.components.backup_plan.application.services import RemoveAllBackupPlansService
|
||||
from tui_rsync.core.components.backup_plan.application.services.backup_plan_service import BackupPlanService
|
||||
from tui_rsync.core.components.backup_plan.domain import BackupPlan, Source, Destination
|
||||
from tui_rsync.core.shared_kernel.components.common import UUID
|
||||
@@ -52,6 +53,17 @@ def when_remove_backup_plan_with_id(context, backup_plan_id):
|
||||
context.exception_raised = False
|
||||
|
||||
|
||||
@when('I remove all backup plans')
|
||||
def when_remove_all_backup_plans(context):
|
||||
try:
|
||||
context.backup_plan_service = context.injector.get(RemoveAllBackupPlansService)
|
||||
context.result_value = context.backup_plan_service.remove_all()
|
||||
except CommandException as e:
|
||||
context.exception_raised = True
|
||||
else:
|
||||
context.exception_raised = False
|
||||
|
||||
|
||||
@when('I read the backup plan with id="{backup_plan_id}"')
|
||||
def when_read_backup_plan_with_id(context, backup_plan_id):
|
||||
try:
|
||||
@@ -91,3 +103,8 @@ def then_cli_executed_successfully(context, result):
|
||||
assert context.exception_raised
|
||||
|
||||
|
||||
@then('the result value should be "{result}"')
|
||||
def then_cli_executed_successfully(context, result):
|
||||
assert result == str(context.result_value)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user