Files
cleveragents-core/features/repositories_uncovered_branches.feature
freemo ca1c341b18
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 14s
CI / build (pull_request) Successful in 17s
CI / quality (pull_request) Successful in 19s
CI / security (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 32s
CI / integration_tests (pull_request) Successful in 2m39s
CI / unit_tests (pull_request) Successful in 5m22s
CI / docker (pull_request) Successful in 38s
CI / benchmark-regression (pull_request) Successful in 17m47s
CI / coverage (pull_request) Successful in 19m6s
CI / lint (push) Successful in 14s
CI / build (push) Successful in 15s
CI / quality (push) Successful in 20s
CI / security (push) Successful in 29s
CI / typecheck (push) Successful in 36s
CI / benchmark-regression (push) Has been skipped
CI / integration_tests (push) Successful in 3m23s
CI / unit_tests (push) Successful in 9m12s
CI / docker (push) Successful in 16s
CI / benchmark-publish (push) Successful in 10m4s
CI / coverage (push) Successful in 19m27s
Tests: Significantly improved coverage of the unit tests
2026-02-22 00:43:08 -05:00

115 lines
6.2 KiB
Gherkin

Feature: Repository uncovered branches and lines
Cover missed lines and branches in repositories.py:
ActorRepository, ToolRepository, ValidationAttachmentRepository,
AutomationProfileRepository, DuplicateValidationAttachmentError,
and ToolRepository._extract_value.
# ActorRepository
Scenario: repo branch cov actor get_default returns None when no default
Given repo branch cov an in-memory database with actor tables
When repo branch cov I call get_default with no default actor set
Then repo branch cov get_default returns None
Scenario: repo branch cov actor list_by_namespace returns matching actors
Given repo branch cov an in-memory database with actor tables
And repo branch cov actors "ns1/alpha" and "ns1/beta" and "ns2/gamma" exist
When repo branch cov I call list_by_namespace with "ns1"
Then repo branch cov 2 actors are returned
And repo branch cov the actor names are "ns1/alpha" and "ns1/beta"
Scenario: repo branch cov actor list_by_namespace returns empty for unknown
Given repo branch cov an in-memory database with actor tables
When repo branch cov I call list_by_namespace with "nonexistent"
Then repo branch cov 0 actors are returned
Scenario: repo branch cov actor list_by_schema_version returns matching
Given repo branch cov an in-memory database with actor tables
And repo branch cov actors with schema versions "1.0" and "2.0" exist
When repo branch cov I call list_by_schema_version with "2.0"
Then repo branch cov 1 actor is returned by schema version
# ── ToolRepository ──────────────────────────────────────────
Scenario: repo branch cov tool repo init with factory keyword
Given repo branch cov an in-memory database with tool tables
When repo branch cov I create ToolRepository with factory keyword
Then repo branch cov the ToolRepository is usable
Scenario: repo branch cov tool repo init with no arguments fails
When repo branch cov I create ToolRepository with no session factory
Then repo branch cov a TypeError is raised
Scenario: repo branch cov tool repo get returns None for missing tool
Given repo branch cov an in-memory database with tool tables
And repo branch cov a ToolRepository instance
When repo branch cov I call get with "nonexistent/tool"
Then repo branch cov get returns None
Scenario: repo branch cov tool repo get_by_name returns None for missing
Given repo branch cov an in-memory database with tool tables
And repo branch cov a ToolRepository instance
When repo branch cov I call get_by_name with "nonexistent/tool"
Then repo branch cov get_by_name returns None
Scenario: repo branch cov tool repo remove succeeds for existing tool
Given repo branch cov an in-memory database with tool tables
And repo branch cov a ToolRepository instance
And repo branch cov a tool "local/removable" exists in the database
When repo branch cov I call remove with "local/removable"
Then repo branch cov remove returns True
Scenario: repo branch cov tool repo remove raises ToolNotFoundError
Given repo branch cov an in-memory database with tool tables
And repo branch cov a ToolRepository instance
When repo branch cov I call remove with "nonexistent/tool"
Then repo branch cov ToolNotFoundError is raised
# ── ToolRepository._extract_value (dict branch) ────────────
Scenario: repo branch cov extract_value from dict object
When repo branch cov I call _extract_value with a dict obj key "name" default ""
Then repo branch cov _extract_value returns the dict value
Scenario: repo branch cov prepare_tool_dict without capability
Given repo branch cov an in-memory database with tool tables
And repo branch cov a ToolRepository instance
When repo branch cov I prepare a tool dict from an object without capability
Then repo branch cov the prepared dict has no capability_json
# ── DuplicateValidationAttachmentError ──────────────────────
Scenario: repo branch cov duplicate validation error with project name
When repo branch cov I create DuplicateValidationAttachmentError with project_name
Then repo branch cov the error message contains the project name
Scenario: repo branch cov duplicate validation error with project and plan
When repo branch cov I create DuplicateValidationAttachmentError with project and plan
Then repo branch cov the error message contains both project and plan
Scenario: repo branch cov duplicate validation error without scoping
When repo branch cov I create DuplicateValidationAttachmentError without scoping
Then repo branch cov the error message has no project or plan
# ── ValidationAttachmentRepository ─────────────────────────
Scenario: repo branch cov validation attach creates attachment
Given repo branch cov an in-memory database with tool tables
And repo branch cov a validation tool "local/check-lint" exists
When repo branch cov I attach validation "local/check-lint" to resource "res-1"
Then repo branch cov the attachment is returned with correct fields
Scenario: repo branch cov validation attach with swapped args auto-corrects
Given repo branch cov an in-memory database with tool tables
And repo branch cov a validation tool "local/check-fmt" exists
When repo branch cov I attach with validation_name "res/123" and resource_id "local/check-fmt"
Then repo branch cov the attachment swaps them correctly
# ── AutomationProfileRepository schema version mismatch ────
Scenario: repo branch cov upsert profile with schema version mismatch
Given repo branch cov an in-memory database with automation profile tables
And repo branch cov an existing automation profile "acme/strict" with schema "1.0"
When repo branch cov I upsert profile "acme/strict" expecting schema "2.0"
Then repo branch cov AutomationProfileSchemaVersionError is raised