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
107 lines
5.2 KiB
Gherkin
107 lines
5.2 KiB
Gherkin
Feature: Project CLI coverage boost for uncovered error paths
|
|
As a developer
|
|
I want to exercise the uncovered error-handling branches in project.py
|
|
So that line and branch coverage improves for cli/commands/project.py
|
|
|
|
Background:
|
|
Given the project CLI coverage mocks are prepared
|
|
|
|
# ── _get_resource_link_repo / _get_resource_registry_service helpers ──
|
|
|
|
Scenario: _get_resource_link_repo returns a link repo from the container
|
|
When I call the real _get_resource_link_repo helper
|
|
Then the coverage link repo helper should return successfully
|
|
|
|
Scenario: _get_resource_registry_service returns a registry service from the container
|
|
When I call the real _get_resource_registry_service helper
|
|
Then the coverage registry service helper should return successfully
|
|
|
|
# ── create command: resource linking raises NotFoundError ──
|
|
|
|
Scenario: create command warns when resource linking raises NotFoundError
|
|
Given the project repo mock is configured for successful create
|
|
And the link repo mock raises NotFoundError on create_link
|
|
When I invoke the CLI create command with name "notfound-proj" and resource "bad-res"
|
|
Then the coverage CLI result should contain "Warning"
|
|
And the coverage CLI exit code should be 0
|
|
|
|
# ── create command: resource linking raises DatabaseError ──
|
|
|
|
Scenario: create command warns when resource linking raises DatabaseError
|
|
Given the project repo mock is configured for successful create
|
|
And the link repo mock raises DatabaseError on create_link
|
|
When I invoke the CLI create command with name "dblink-proj" and resource "fail-res"
|
|
Then the coverage CLI result should contain "Warning"
|
|
And the coverage CLI exit code should be 0
|
|
|
|
# ── create command: re-fetch project raises generic Exception ──
|
|
|
|
Scenario: create command falls back when re-fetching project raises Exception
|
|
Given the project repo mock is configured for create but get raises Exception
|
|
When I invoke the CLI create command with name "refetch-proj" without resources
|
|
Then the coverage CLI result should contain "created"
|
|
And the coverage CLI exit code should be 0
|
|
|
|
# ── link-resource command: create_link raises DatabaseError ──
|
|
|
|
Scenario: link-resource command fails when create_link raises DatabaseError
|
|
Given the project repo mock returns a valid project for get
|
|
And the registry mock returns a valid resource
|
|
And the link repo mock raises DatabaseError on create_link for link-resource
|
|
When I invoke the CLI link-resource command for project "local/linkdb-proj" resource "some-res"
|
|
Then the coverage CLI result should contain "Error linking resource"
|
|
And the coverage CLI exit code should be 1
|
|
|
|
# ── unlink-resource command: user declines confirmation ──
|
|
|
|
Scenario: unlink-resource command aborts when user declines confirmation
|
|
Given the project repo mock returns a valid project for get
|
|
And the registry mock returns a valid resource
|
|
And the link repo mock returns a matching link for unlink
|
|
When I invoke the CLI unlink-resource command without yes and user declines
|
|
Then the coverage CLI exit code should be 1
|
|
|
|
# ── unlink-resource command: remove_link raises DatabaseError ──
|
|
|
|
Scenario: unlink-resource command fails when remove_link raises DatabaseError
|
|
Given the project repo mock returns a valid project for get
|
|
And the registry mock returns a valid resource
|
|
And the link repo mock returns a matching link for unlink
|
|
And the link repo mock raises DatabaseError on remove_link
|
|
When I invoke the CLI unlink-resource command with yes
|
|
Then the coverage CLI result should contain "Error unlinking resource"
|
|
And the coverage CLI exit code should be 1
|
|
|
|
# ── list command: list_projects raises DatabaseError ──
|
|
|
|
Scenario: list command fails when list_projects raises DatabaseError
|
|
Given the project repo mock raises DatabaseError on list_projects
|
|
When I invoke the CLI list command
|
|
Then the coverage CLI result should contain "Error listing projects"
|
|
And the coverage CLI exit code should be 1
|
|
|
|
# ── delete command: user declines confirmation ──
|
|
|
|
Scenario: delete command aborts when user declines confirmation
|
|
Given the project repo mock returns a project with no linked resources
|
|
When I invoke the CLI delete command without yes and user declines
|
|
Then the coverage CLI exit code should be 1
|
|
|
|
# ── delete command: repo.delete raises DatabaseError ──
|
|
|
|
Scenario: delete command fails when repo.delete raises DatabaseError
|
|
Given the project repo mock returns a project with no linked resources
|
|
And the project repo mock raises DatabaseError on delete
|
|
When I invoke the CLI delete command with yes
|
|
Then the coverage CLI result should contain "Error deleting project"
|
|
And the coverage CLI exit code should be 1
|
|
|
|
# ── delete command: repo.delete returns False ──
|
|
|
|
Scenario: delete command fails when repo.delete returns False
|
|
Given the project repo mock returns a project with no linked resources
|
|
And the project repo mock returns False on delete
|
|
When I invoke the CLI delete command with yes
|
|
Then the coverage CLI result should contain "could not be deleted"
|
|
And the coverage CLI exit code should be 1
|