Files
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

60 lines
2.5 KiB
Plaintext

*** Settings ***
Documentation Smoke tests for Config CLI commands (set, get, list)
Resource ${CURDIR}/common.resource
Suite Setup Setup Test Environment
Suite Teardown Cleanup Test Environment
*** Variables ***
${HELPER} ${CURDIR}/helper_config_cli.py
*** Test Cases ***
Config List Shows Settings
[Documentation] Verify that ``config list`` outputs known settings
${result}= Run Process ${PYTHON} ${HELPER} list cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} config-cli-list-ok
Config List JSON Format
[Documentation] Verify that ``config list --format json`` produces valid JSON
${result}= Run Process ${PYTHON} ${HELPER} list-json cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} config-cli-list-json-ok
Config Set Get Roundtrip
[Documentation] Verify that ``config set`` followed by ``config get`` returns the value
[Tags] tdd_issue tdd_issue_4302
${result}= Run Process ${PYTHON} ${HELPER} set-get-roundtrip cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} config-cli-set-get-roundtrip-ok
Config Secret Masking
[Documentation] Verify that secret values are masked in list output
${result}= Run Process ${PYTHON} ${HELPER} secret-masking cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} config-cli-secret-masking-ok
Config Show Secrets Flag
[Documentation] Verify that ``--show-secrets`` flag is accepted
${result}= Run Process ${PYTHON} ${HELPER} show-secrets cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} config-cli-show-secrets-ok
Config List With Filter
[Documentation] Verify that ``config list`` with regex filter works
${result}= Run Process ${PYTHON} ${HELPER} list-filter cwd=${WORKSPACE}
Log ${result.stdout}
Log ${result.stderr}
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} config-cli-list-filter-ok