mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-09-08 14:37:45 +00:00
25 lines
701 B
Python
25 lines
701 B
Python
from behave import given, when, then
|
|
from peewee import IntegrityError
|
|
from tui_rsync.models.models import create_tables
|
|
from tui_rsync.models.models import Path
|
|
|
|
@given('a path "{path_str}"')
|
|
def given_path(context, path_str):
|
|
create_tables()
|
|
context.path_str = path_str
|
|
|
|
@when('I add the path to the database')
|
|
def add_path(context):
|
|
try:
|
|
context.path = Path.create(path=context.path_str)
|
|
except IntegrityError:
|
|
context.exception_raised = True
|
|
else:
|
|
context.exception_raised = False
|
|
|
|
@then('the path should be added successfully')
|
|
def path_has_added(context):
|
|
assert context.path.path == context.path_str
|
|
assert context.exception_raised == False
|
|
|