b82a9b6962
CI / lint (push) Waiting to run
CI / typecheck (push) Waiting to run
CI / security (push) Waiting to run
CI / quality (push) Waiting to run
CI / unit_tests (push) Waiting to run
CI / integration_tests (push) Waiting to run
CI / e2e_tests (push) Waiting to run
CI / coverage (push) Blocked by required conditions
CI / benchmark-regression (push) Blocked by required conditions
CI / benchmark-publish (push) Waiting to run
CI / build (push) Waiting to run
CI / docker (push) Blocked by required conditions
CI / helm (push) Waiting to run
CI / status-check (push) Blocked by required conditions
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
249 lines
12 KiB
Gherkin
249 lines
12 KiB
Gherkin
Feature: Session CLI Coverage Boost
|
|
Additional scenarios that exercise previously uncovered code paths
|
|
in the session.py CLI commands module.
|
|
|
|
Background:
|
|
Given the session CLI coverage boost module is set up
|
|
|
|
# ---------------------------------------------------------------
|
|
# create command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: create command succeeds with rich format
|
|
Given session coverage boost a mock service that creates a session
|
|
When session coverage boost I invoke the create command with rich format
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Session created"
|
|
|
|
Scenario: create command succeeds with JSON format
|
|
Given session coverage boost a mock service that creates a session
|
|
When session coverage boost I invoke the create command with json format
|
|
Then session coverage boost the exit code is 0
|
|
|
|
Scenario: create command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on create
|
|
When session coverage boost I invoke the create command with rich format
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# list command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: list command succeeds with sessions in rich format
|
|
Given session coverage boost a mock service that lists sessions
|
|
When session coverage boost I invoke the list command with rich format
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Sessions"
|
|
|
|
Scenario: list command succeeds with sessions in JSON format
|
|
Given session coverage boost a mock service that lists sessions
|
|
When session coverage boost I invoke the list command with json format
|
|
Then session coverage boost the exit code is 0
|
|
|
|
Scenario: list command with no sessions in rich format
|
|
Given session coverage boost a mock service that lists empty sessions
|
|
When session coverage boost I invoke the list command with rich format
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "No sessions found"
|
|
|
|
Scenario: list command with no sessions in JSON format
|
|
Given session coverage boost a mock service that lists empty sessions
|
|
When session coverage boost I invoke the list command with json format
|
|
Then session coverage boost the exit code is 0
|
|
|
|
Scenario: list command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on list
|
|
When session coverage boost I invoke the list command with rich format
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# show command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: show command with cost budget having a max cost
|
|
Given session coverage boost a mock service returning a session with cost budget max 10
|
|
When session coverage boost I invoke the show command
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Cost Budget"
|
|
|
|
Scenario: show command with cost budget unlimited
|
|
Given session coverage boost a mock service returning a session with unlimited cost budget
|
|
When session coverage boost I invoke the show command
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "unlimited"
|
|
|
|
Scenario: show command with messages and linked plans in rich format
|
|
Given session coverage boost a mock service returning a session with messages and plans
|
|
When session coverage boost I invoke the show command
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Recent Messages"
|
|
And session coverage boost the output contains "Linked Plans"
|
|
|
|
Scenario: show command with JSON format
|
|
Given session coverage boost a mock service returning a session with messages and plans
|
|
When session coverage boost I invoke the show command with json format
|
|
Then session coverage boost the exit code is 0
|
|
|
|
Scenario: show command catches SessionNotFoundError
|
|
Given session coverage boost a mock service that raises SessionNotFoundError on get
|
|
When session coverage boost I invoke the show command
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Session not found"
|
|
|
|
Scenario: show command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on get
|
|
When session coverage boost I invoke the show command
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# delete command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: delete command succeeds with --yes flag
|
|
Given session coverage boost a mock service for delete
|
|
When session coverage boost I invoke the delete command with yes
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "deleted"
|
|
|
|
Scenario: delete command aborted by user
|
|
Given session coverage boost a mock service for delete
|
|
When session coverage boost I invoke the delete command without yes answering no
|
|
Then session coverage boost the output contains "Aborted"
|
|
|
|
Scenario: delete command catches SessionNotFoundError
|
|
Given session coverage boost a mock service that raises SessionNotFoundError on get
|
|
When session coverage boost I invoke the delete command with yes
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Session not found"
|
|
|
|
Scenario: delete command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on delete
|
|
When session coverage boost I invoke the delete command with yes
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# export command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: export command to stdout
|
|
Given session coverage boost a mock service for export
|
|
When session coverage boost I invoke the export command to stdout
|
|
Then session coverage boost the exit code is 0
|
|
|
|
Scenario: export command to file
|
|
Given session coverage boost a mock service for export
|
|
And session coverage boost a temporary directory for export
|
|
When session coverage boost I invoke the export command to a file
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "exported"
|
|
|
|
Scenario: export command to existing file without force
|
|
Given session coverage boost a mock service for export
|
|
And session coverage boost a temporary directory with existing file
|
|
When session coverage boost I invoke the export command to existing file without force
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "File already exists"
|
|
|
|
Scenario: export command catches SessionNotFoundError
|
|
Given session coverage boost a mock service that raises SessionNotFoundError on export
|
|
When session coverage boost I invoke the export command to stdout
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Session not found"
|
|
|
|
Scenario: export command catches SessionExportError
|
|
Given session coverage boost a mock service that raises SessionExportError on export
|
|
When session coverage boost I invoke the export command to stdout
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Export error"
|
|
|
|
Scenario: export command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on export
|
|
When session coverage boost I invoke the export command to stdout
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# import command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: import command succeeds
|
|
Given session coverage boost a mock service for import
|
|
And session coverage boost a temporary import file with valid JSON
|
|
When session coverage boost I invoke the import command
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Session Import"
|
|
And session coverage boost the output contains "Import completed"
|
|
|
|
Scenario: import command with missing file
|
|
When session coverage boost I invoke the import command with missing file
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "File not found"
|
|
|
|
Scenario: import command with invalid JSON file
|
|
Given session coverage boost a temporary import file with invalid JSON
|
|
When session coverage boost I invoke the import command with invalid json
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Invalid JSON"
|
|
|
|
Scenario: import command catches SessionImportError
|
|
Given session coverage boost a mock service that raises SessionImportError on import
|
|
And session coverage boost a temporary import file with valid JSON
|
|
When session coverage boost I invoke the import command expecting import error
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Import error"
|
|
|
|
Scenario: import command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on import
|
|
And session coverage boost a temporary import file with valid JSON
|
|
When session coverage boost I invoke the import command expecting database error
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# tell command
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: tell command succeeds without streaming
|
|
Given session coverage boost a mock service for tell
|
|
When session coverage boost I invoke the tell command without stream
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Acknowledged"
|
|
|
|
Scenario: tell command succeeds with streaming
|
|
Given session coverage boost a mock service for tell
|
|
When session coverage boost I invoke the tell command with stream
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "Acknowledged"
|
|
|
|
Scenario: tell command with actor override
|
|
Given session coverage boost a mock service for tell
|
|
When session coverage boost I invoke the tell command with actor override
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains "openai/gpt-4"
|
|
|
|
Scenario: tell command catches SessionNotFoundError
|
|
Given session coverage boost a mock service that raises SessionNotFoundError on append
|
|
When session coverage boost I invoke the tell command without stream
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Session not found"
|
|
|
|
Scenario: tell command catches DatabaseError
|
|
Given session coverage boost a mock service that raises DatabaseError on append
|
|
When session coverage boost I invoke the tell command without stream
|
|
Then session coverage boost the exit code is 1
|
|
And session coverage boost the output contains "Database unavailable"
|
|
|
|
# ---------------------------------------------------------------
|
|
# show command with long message content truncation
|
|
# ---------------------------------------------------------------
|
|
|
|
Scenario: show command truncates long message content
|
|
Given session coverage boost a mock service returning a session with a long message
|
|
When session coverage boost I invoke the show command
|
|
Then session coverage boost the exit code is 0
|
|
And session coverage boost the output contains truncated message indicator
|