Files
cleveragents-core/features/resource_cli_coverage_boost.feature
freemo 77a0a95dc3
CI / lint (pull_request) Successful in 26s
CI / security (pull_request) Successful in 26s
CI / typecheck (pull_request) Successful in 1m2s
CI / quality (pull_request) Successful in 17s
CI / build (pull_request) Successful in 25s
CI / integration_tests (pull_request) Failing after 3m2s
CI / lint (push) Successful in 23s
CI / unit_tests (pull_request) Failing after 17m24s
CI / docker (pull_request) Has been skipped
CI / typecheck (push) Successful in 40s
CI / security (push) Successful in 37s
CI / quality (push) Successful in 25s
CI / build (push) Successful in 16s
CI / integration_tests (push) Failing after 7m16s
CI / unit_tests (push) Failing after 24m35s
CI / docker (push) Has been skipped
CI / coverage (pull_request) Failing after 37m0s
CI / coverage (push) Failing after 37m15s
Tests: Added coverage to get us to 97%
2026-02-17 21:00:05 -05:00

68 lines
3.3 KiB
Gherkin

Feature: Resource CLI coverage boost for remaining uncovered lines
As a developer
I want edge-case paths in resource.py thoroughly tested
So that the line-rate and branch-rate improve beyond 0.93 / 0.88
# ---- _get_registry_service (lines 79-81) ----
Scenario: _get_registry_service delegates to the DI container
Given the DI container is mocked for resource registry
When _get_registry_service is called directly
Then the returned service should be the mock registry service
# ---- type_add --update re-raises ValidationError (line 181) ----
Scenario: type_add --update re-raises ValidationError whose message lacks "already exists"
Given a mock resource service that raises a non-already-exists ValidationError on register_type
When I invoke type add with update flag via CliRunner
Then the CliRunner exit code should be non-zero
And the CliRunner output should contain "Validation error"
# ---- type_add FileNotFoundError (lines 193-195) ----
Scenario: type_add catches FileNotFoundError from service
Given a mock resource service that raises FileNotFoundError on register_type
When I invoke type add with a dummy config via CliRunner
Then the CliRunner exit code should be non-zero
And the CliRunner output should contain "Config file not found"
# ---- type_remove confirm declined (lines 234-236) ----
Scenario: type_remove aborts when user declines confirmation prompt
Given a mock resource service with a removable custom type
When I invoke type remove without --yes and answer no via CliRunner
Then the CliRunner exit code should be non-zero
And the CliRunner output should contain "Aborted"
# ---- type_remove row is None (lines 260-262) ----
Scenario: type_remove aborts when DB row is None after query
Given a mock resource service whose session returns no row for the type
When I invoke type remove with --yes via CliRunner for the phantom type
Then the CliRunner exit code should be non-zero
And the CliRunner output should contain "Resource type not found"
# ---- type_remove generic exception triggers rollback (lines 267-269) ----
Scenario: type_remove rolls back session on unexpected exception
Given a mock resource service whose session delete raises a generic exception
When I invoke type remove with --yes via CliRunner for the failing type
Then the CliRunner exit code should be non-zero
And the mock session rollback should have been called for type remove
# ---- resource_remove edge_count > 0 (lines 653-658) ----
Scenario: resource_remove aborts when resource has edges
Given a mock resource service whose session reports edges on the resource
When I invoke resource remove with --yes via CliRunner for the edged resource
Then the CliRunner exit code should be non-zero
And the CliRunner output should contain "edge(s) still reference it"
# ---- resource_remove generic Exception rollback (lines 668-672) ----
Scenario: resource_remove rolls back session on unexpected exception
Given a mock resource service whose session delete raises a generic exception for resource
When I invoke resource remove with --yes via CliRunner for the failing resource
Then the CliRunner exit code should be non-zero
And the mock session rollback should have been called for resource remove