59 lines
3.0 KiB
Gherkin
59 lines
3.0 KiB
Gherkin
Feature: Skill CLI coverage boost
|
|
Target remaining uncovered lines in src/cleveragents/cli/commands/skill.py:
|
|
- Lines 82-103: _get_skill_service DB initialization and fallback
|
|
- Line 889: tools non-rich format source_type "agent_skills" branch
|
|
- Lines 984-985: refresh defensive guard for name=None after earlier check
|
|
|
|
Background:
|
|
Given boost- a fresh skill CLI service
|
|
|
|
# -------------------------------------------------------------------
|
|
# _get_skill_service: DB initialization path (lines 82-100)
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: _get_skill_service creates service with DB when container is available
|
|
Given boost- the module-level _service is set to None
|
|
And boost- the DI container and DB components are mocked successfully
|
|
When boost- I call _get_skill_service
|
|
Then boost- the returned service should have a skill_repo
|
|
And boost- create_engine should have been called with the mock database URL
|
|
|
|
# -------------------------------------------------------------------
|
|
# _get_skill_service: exception fallback (lines 101-103)
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: _get_skill_service falls back to in-memory when DB setup fails
|
|
Given boost- the module-level _service is set to None
|
|
And boost- the DI container import will raise an exception
|
|
When boost- I call _get_skill_service
|
|
Then boost- the returned service should be an in-memory SkillService
|
|
And boost- the returned service should have no skill_repo
|
|
|
|
Scenario: _get_skill_service falls back when create_engine raises
|
|
Given boost- the module-level _service is set to None
|
|
And boost- create_engine will raise an OperationalError
|
|
When boost- I call _get_skill_service
|
|
Then boost- the returned service should be an in-memory SkillService
|
|
And boost- the returned service should have no skill_repo
|
|
|
|
# -------------------------------------------------------------------
|
|
# tools non-rich format: agent_skill: source type (line 889)
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Tools JSON output shows agent_skills source for agent_skill entries
|
|
Given boost- a registered skill "local/agent-skill-test" with agent_skills
|
|
When boost- I invoke tools "local/agent-skill-test" in format "json"
|
|
Then boost- the CLI exit code should be 0
|
|
And boost- the JSON output should be valid
|
|
And boost- the JSON tools list should contain an entry with source "agent_skills"
|
|
|
|
# -------------------------------------------------------------------
|
|
# refresh: defensive name=None guard (lines 984-985)
|
|
# -------------------------------------------------------------------
|
|
|
|
Scenario: Refresh defensive guard fires when name is None after bypassing first check
|
|
Given boost- a fresh skill CLI service
|
|
When boost- I call refresh directly with name None and all_skills False bypassing first guard
|
|
Then boost- the second guard should have printed the error message
|
|
And boost- the function should have raised Abort
|