Add the E2E tests for the CLI interface.

This commit is contained in:
2025-01-23 19:45:14 +02:00
parent 6b247fbe4e
commit 18eb9b4d91
4 changed files with 67 additions and 1 deletions
+34
View File
@@ -0,0 +1,34 @@
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 successfully')
def then_cli_executed_successfully(context):
assert context.cli_result.exit_code == 0
@then('the CLI executed with an error')
def then_cli_executed_with_error(context):
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