Update the show all plans command to show if there're no plans.

This commit is contained in:
2025-01-27 12:06:58 +02:00
parent b999975695
commit 9729f442c2
15 changed files with 157 additions and 40 deletions
+33 -5
View File
@@ -1,18 +1,46 @@
Feature: Deleting a backup plan with the CLI
Feature: Show a backup plan with the CLI
@fixture.injector
@fixture.in_memory_database
@fixture.seeds
@fixture.cli
Scenario Outline: Deleting a backup plan with the CLI
Scenario Outline: Show a backup plan with the CLI
Given the CLI arguments are "<arguments>"
And I have a backup plan with id="<existing_backup_plan_id>"
When I run the CLI
Then the CLI executed with "<result>"
Examples:
| arguments | existing_backup_plan_id | result | description |
| plans show one -i 8aa59e7e-dc75-459b-beb5-b710b39be583 | 8aa59e7e-dc75-459b-beb5-b710b39be583 | success | delete an existing plan |
| plans show one -i 8aa59e7e-dc75-459b-aeb5-b710b39be583 | 8aa59e7e-dc75-459b-beb5-b710b39be512 | error | delete a non-existing plan |
| arguments | existing_backup_plan_id | result | description |
| plans show one -i 8aa59e7e-dc75-459b-beb5-b710b39be583 | 8aa59e7e-dc75-459b-beb5-b710b39be583 | success | show an existing plan |
| plans show one -i 8aa59e7e-dc75-459b-aeb5-b710b39be583 | 8aa59e7e-dc75-459b-beb5-b710b39be512 | error | show a non-existing plan |
@fixture.injector
@fixture.in_memory_database
@fixture.cli
Scenario Outline: Show no backup plans with the CLI
Given the CLI arguments are "<arguments>"
When I run the CLI
Then the CLI executed with "<result>"
And the CLI output contains "<result_message>"
Examples:
| arguments | result | result_message | description |
| plans show all | success | No backup plans. | shows no plans |
@fixture.injector
@fixture.in_memory_database
@fixture.seeds
@fixture.cli
Scenario Outline: Show backup plans with the CLI
Given the CLI arguments are "<arguments>"
And I have a backup plan with id="8aa59e7e-dc75-459b-beb5-b710b39be583"
When I run the CLI
Then the CLI executed with "<result>"
And the CLI output contains "8aa59e7e-dc75-459b-beb5-b710b39be583"
And the CLI output doesn't contains "<no_message>"
Examples:
| arguments | result | no_message | description |
| plans show all | success | No backup plans. | shows plans |
+4 -2
View File
@@ -3,9 +3,7 @@ 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')
@@ -27,6 +25,10 @@ def then_cli_output_contains(context, string):
assert string in context.cli_result.stdout
@then('the CLI output doesn\'t contains "{string}"')
def then_cli_output_contains(context, string):
assert not (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