fix(budget): rewrite cost reporting CLI test step implementations
Rewrite cost_reporting_cli_steps.py to properly test plan status and session show cost reporting in CLI output. - Add @when step implementations that execute CLI via CliRunner - Add proper @given fixtures that create Plan and Session domain objects with CostMetadata/SessionTokenUsage data - Replace setattr-based assertions with direct context.result assertions - Import json module and add _unwrap_envelope helper for CLI spec envelopes - Follow existing test patterns from session_cli_steps.py Closes #10616 --- Automated by CleverAgents Bot Supervisor: PR Fix | Agent: task-implementor
This commit is contained in:
@@ -4,25 +4,29 @@ Feature: Cost reporting in plan status and session show CLI output
|
||||
So that I can track how much I've spent on plans and sessions
|
||||
|
||||
Scenario: Plan status JSON output includes cost field
|
||||
Given a plan exists with cost metadata
|
||||
When I run "agents plan status <plan_id> --format json"
|
||||
Given a plan status CLI runner with mocked service
|
||||
And a plan exists with cost metadata
|
||||
When I run plan status --format json for plan <plan_id>
|
||||
Then the JSON output contains a "cost" field
|
||||
And the cost field contains cost metadata
|
||||
|
||||
Scenario: Session show JSON output includes estimated cost
|
||||
Given a session exists with token usage
|
||||
When I run "agents session show <session_id> --format json"
|
||||
Given a session show CLI runner with mocked service
|
||||
And a session exists with token usage
|
||||
When I run session show --format json for session <session_id>
|
||||
Then the JSON output contains "estimated_cost" field
|
||||
And the estimated_cost is properly formatted as currency
|
||||
|
||||
Scenario: Plan status rich output displays cost panel
|
||||
Given a plan exists with cost metadata
|
||||
When I run "agents plan status <plan_id>"
|
||||
Given a plan status CLI runner with mocked service
|
||||
And a plan exists with cost metadata
|
||||
When I run plan status for plan <plan_id>
|
||||
Then the output contains cost information
|
||||
And the cost information is properly formatted
|
||||
|
||||
Scenario: Session show rich output displays cost information
|
||||
Given a session exists with token usage
|
||||
When I run "agents session show <session_id>"
|
||||
Given a session show CLI runner with mocked service
|
||||
And a session exists with token usage
|
||||
When I run session show for session <session_id>
|
||||
Then the output contains cost information
|
||||
And the cost information is properly formatted
|
||||
|
||||
Reference in New Issue
Block a user