You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tui-rsync/features/steps/cli_runner_steps.py

34 lines
929 B

from behave import given, when, then
@given('the CLI arguments are "{arguments}"')
def given_cli_arguments(context, arguments):
print(f"{arguments}")
context.arguments = arguments.split()
print(f"{context.arguments}")
@when('I run the CLI')
def when_run_cli(context):
context.cli_result = context.cli_runner.invoke(context.cli_app, context.arguments)
@then('the CLI executed with "{result}"')
def then_cli_executed_successfully(context, result):
match result:
case "success":
assert context.cli_result.exit_code == 0
case "error":
assert context.cli_result.exit_code == 0
@then('the CLI output contains "{string}"')
def then_cli_output_contains(context, string):
assert string in context.cli_result.stdout
@then('the CLI contains the error: "{string}"')
def then_cli_output_contains_error(context, string):
assert string in context.cli_result.stdout