mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
Add a test for the creating source feature.
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
Feature: Creating the source
|
||||||
|
|
||||||
|
Scenario: Adding an new unique source
|
||||||
|
Given the label "db"
|
||||||
|
And the path "/db"
|
||||||
|
When I add the source
|
||||||
|
Then the source should be added successfully
|
||||||
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
from behave import given, when, then
|
||||||
|
from peewee import IntegrityError
|
||||||
|
from tui_rsync.models.models import create_tables
|
||||||
|
from tui_rsync.models.models import Source
|
||||||
|
|
||||||
|
@given('the label "{label}"')
|
||||||
|
def given_source_label(context, label):
|
||||||
|
create_tables()
|
||||||
|
context.label = label
|
||||||
|
|
||||||
|
@given('the path "{source_path}"')
|
||||||
|
def given_source_path(context, source_path):
|
||||||
|
context.source_path = source_path
|
||||||
|
|
||||||
|
@when('I add the source')
|
||||||
|
def add_source(context):
|
||||||
|
try:
|
||||||
|
context.source = Source.create_save(
|
||||||
|
context.label,
|
||||||
|
context.source_path,
|
||||||
|
[],
|
||||||
|
"",
|
||||||
|
)
|
||||||
|
except IntegrityError:
|
||||||
|
context.exception_raised = True
|
||||||
|
else:
|
||||||
|
context.exception_raised = False
|
||||||
|
|
||||||
|
@then('the source should be added successfully')
|
||||||
|
def path_has_added(context):
|
||||||
|
assert context.exception_raised == False
|
||||||
|
|
||||||
|
assert context.source.label == context.label
|
||||||
|
assert context.source.source.path == context.source_path
|
||||||
|
|
||||||
Reference in New Issue
Block a user