mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-20 05:37:43 +00:00
Add the tests for the read query.
This commit is contained in:
@@ -5,6 +5,7 @@ from tui_rsync.core.components.backup_plan.application.services.backup_plan_serv
|
||||
from tui_rsync.core.components.backup_plan.domain import BackupPlan, Source, Destination
|
||||
from tui_rsync.core.shared_kernel.components.common import UUID
|
||||
from tui_rsync.core.shared_kernel.ports.Exceptions import CommandException
|
||||
from tui_rsync.core.shared_kernel.ports.Exceptions.query_exception import QueryException
|
||||
|
||||
|
||||
@given('the label "{label}"')
|
||||
@@ -40,23 +41,23 @@ def add_backup_plan(context):
|
||||
context.exception_raised = False
|
||||
|
||||
|
||||
@when('I delete the backup plan')
|
||||
def add_backup_plan(context):
|
||||
@when('I remove the backup plan with id="{backup_plan_id}"')
|
||||
def when_remove_backup_plan_with_id(context, backup_plan_id):
|
||||
try:
|
||||
context.deleted_result = context.backup_plan_service.delete(context.backup_plan.id)
|
||||
context.backup_plan = context.backup_plan_service.get_by_id(context.backup_plan.id)
|
||||
except Exception as e:
|
||||
context.backup_plan_service = context.injector.get(BackupPlanService)
|
||||
context.backup_plan_service.delete(UUID(backup_plan_id))
|
||||
except CommandException as e:
|
||||
context.exception_raised = True
|
||||
else:
|
||||
context.exception_raised = False
|
||||
|
||||
|
||||
@when('I remove the backup plan with id="{backup_plan_id}"')
|
||||
def given_existing_backup_plan_id_seed(context, backup_plan_id):
|
||||
@when('I read the backup plan with id="{backup_plan_id}"')
|
||||
def when_read_backup_plan_with_id(context, backup_plan_id):
|
||||
try:
|
||||
context.backup_plan_service = context.injector.get(BackupPlanService)
|
||||
context.backup_plan_service.delete(UUID(backup_plan_id))
|
||||
except CommandException as e:
|
||||
context.backup_plan_service.get_by_id(UUID(backup_plan_id))
|
||||
except QueryException as e:
|
||||
context.exception_raised = True
|
||||
else:
|
||||
context.exception_raised = False
|
||||
@@ -80,12 +81,6 @@ def backup_plan_has_added(context):
|
||||
context.destinations
|
||||
)
|
||||
|
||||
@then('it should be deleted successfully')
|
||||
def backup_plan_has_deleted(context):
|
||||
assert context.exception_raised == False
|
||||
assert context.backup_plan is None
|
||||
assert context.deleted_result
|
||||
|
||||
|
||||
@then('the result should be "{result}"')
|
||||
def then_cli_executed_successfully(context, result):
|
||||
|
||||
Reference in New Issue
Block a user