Files
cleveragents-core/robot/automation_profile_cli.robot
HAL9000 12828ca7e8 fix(config): use module-level _CONFIG_DIR/_CONFIG_PATH in _get_service for patchability
Tests in features/config_cli_*.feature and robot/config_cli.robot /
robot/automation_profile_cli.robot patch
``cleveragents.cli.commands.config._CONFIG_DIR`` /
``_CONFIG_PATH`` with ``unittest.mock.patch.object`` to redirect
the CLI to a temp config directory. ``_get_service`` was calling
``_get_config_dir()`` and recomputing the path from
``CLEVERAGENTS_HOME`` / ``Path.home()`` on every invocation, which
bypassed the patches and routed every test through the developer's
real ``~/.cleveragents`` — producing the 8 unit_tests scenario
failures and 3 integration Robot failures observed on CI.

Read the patched module-level constants directly so the patches
take effect. Module-load-time path resolution (the assignment at
file scope) still honours ``CLEVERAGENTS_HOME``.

The 4 robot tests that had ``tdd_expected_fail`` for tdd_issue_4204
and tdd_issue_4302 now pass — drop the tag so the
tdd_expected_fail_listener doesn't invert their PASS into a FAIL.

ISSUES CLOSED: #3773
2026-06-16 23:08:30 -04:00

67 lines
3.0 KiB
Plaintext

*** Settings ***
Documentation Smoke tests for automation-profile CLI commands
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER_SCRIPT} robot/helper_automation_profile_cli.py
*** Test Cases ***
Add Automation Profile
[Documentation] Add a custom automation profile from YAML config
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} add cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} add-profile-ok
Show Automation Profile
[Documentation] Show a built-in automation profile
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} show cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} show-profile-ok
Show Automation Profile JSON
[Documentation] Show a profile in JSON format
[Tags] tdd_issue tdd_issue_4204
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} show-json cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} show-json-ok
Show Automation Profile YAML
[Documentation] Show a profile in YAML format
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} show-yaml cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} show-yaml-ok
List Automation Profiles
[Documentation] List all automation profiles
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} list cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} list-profiles-ok
List Automation Profiles JSON
[Documentation] List profiles in JSON format
[Tags] tdd_issue tdd_issue_4204
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} list-json cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} list-json-ok
Remove Automation Profile
[Documentation] Remove a custom automation profile
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} remove cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} remove-profile-ok
Remove Built-in Profile Fails
[Documentation] Verify built-in profiles cannot be removed
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} remove-builtin-fails cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} remove-builtin-fails-ok
All Automation Profile CLI Tests
[Documentation] Run all automation-profile CLI tests
[Tags] tdd_issue tdd_issue_4204
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} all cwd=${WORKSPACE}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} all-tests-ok