Files
cleveragents-core/features/server_cli_coverage_boost.feature

104 lines
5.3 KiB
Gherkin

@phase2 @a2a @server-cli-coverage
Feature: Server CLI command coverage boost
As a developer
I want full test coverage for server.py CLI commands
So that the server_connect (rich format), server_status, and resolve_server_mode
error paths are all exercised
# -----------------------------------------------------------------------
# resolve_server_mode exception paths (lines 58-59)
# -----------------------------------------------------------------------
Scenario: resolve_server_mode returns disabled when resolve raises ValueError
Given a mock config service that raises ValueError on resolve
When I call resolve_server_mode with the mock
Then the server mode should be "disabled"
Scenario: resolve_server_mode returns disabled when resolve raises KeyError
Given a mock config service that raises KeyError on resolve
When I call resolve_server_mode with the mock
Then the server mode should be "disabled"
# -----------------------------------------------------------------------
# server_connect — rich format output (lines 132-142)
# -----------------------------------------------------------------------
Scenario: server_connect renders Rich Panel when format is rich
Given a mock config service that accepts writes
When I call server_connect with url "https://rich.example.com" and rich format
Then the captured console output should contain "Server Connection (Stub)"
And the captured console output should contain "https://rich.example.com"
And the captured console output should contain "stubbed"
And the captured console output should contain "not yet implemented"
Scenario: server_connect rich output includes namespace and TLS verify
Given a mock config service that accepts writes
When I call server_connect with url "https://ns.example.com" namespace "my-team" tls_verify false and rich format
Then the captured console output should contain "my-team"
And the captured console output should contain "False"
# -----------------------------------------------------------------------
# server_status — full function, no URL configured (lines 157-204)
# -----------------------------------------------------------------------
Scenario: server_status with json format when no URL is configured
Given a mock config service that resolves with no server config
When I call server_status with format "json"
Then the echoed output should contain "disabled"
And the echoed output should contain "server_mode"
Scenario: server_status with plain format when no URL is configured
Given a mock config service that resolves with no server config
When I call server_status with format "plain"
Then the echoed output should contain "disabled"
# -----------------------------------------------------------------------
# server_status — URL is configured (stubbed mode)
# -----------------------------------------------------------------------
Scenario: server_status with json format when URL is configured
Given a mock config service that resolves with full server config
When I call server_status with format "json"
Then the echoed output should contain "stubbed"
And the echoed output should contain "https://configured.example.com"
And the echoed output should contain "production"
# -----------------------------------------------------------------------
# server_status — rich format rendering (lines 196-206)
# -----------------------------------------------------------------------
Scenario: server_status renders Rich Panel when format is rich and no URL
Given a mock config service that resolves with no server config
When I call server_status with format "rich"
Then the captured console output should contain "Server Status"
And the captured console output should contain "disabled"
And the captured console output should contain "(not configured)"
Scenario: server_status renders Rich Panel when format is rich and URL is configured
Given a mock config service that resolves with full server config
When I call server_status with format "rich"
Then the captured console output should contain "Server Status"
And the captured console output should contain "stubbed"
And the captured console output should contain "https://configured.example.com"
# -----------------------------------------------------------------------
# server_status — exception paths for namespace / tls-verify (lines 168-183)
# -----------------------------------------------------------------------
Scenario: server_status defaults namespace when resolve raises ValueError
Given a mock config service where namespace resolve raises ValueError
When I call server_status with format "json"
Then the echoed output should contain "default"
Scenario: server_status defaults tls_verify when resolve raises KeyError
Given a mock config service where tls-verify resolve raises KeyError
When I call server_status with format "json"
Then the echoed output should contain "true"
Scenario: server_status defaults all fields when all resolves raise exceptions
Given a mock config service where all resolves raise exceptions
When I call server_status with format "json"
Then the echoed output should contain "disabled"
And the echoed output should contain "null"
And the echoed output should contain "default"