*** Settings ***
Documentation     Smoke tests for project context CLI commands
Resource          ${CURDIR}/common.resource
Suite Setup       Setup Test Environment
Suite Teardown    Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_project_context_cli.py

*** Test Cases ***
Context Policy Set And Show Round Trip
    [Documentation]    Set a context policy and verify it reads back correctly
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    set-show    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-set-show-ok

Context Inspect Wired To ACMS
    [Documentation]    Verify inspect queries the ACMS tier service and returns tier state
    [Tags]    tdd_issue    tdd_issue_4313    tdd_expected_fail

    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    inspect-wired    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-inspect-wired-ok

Context Simulate Wired To ACMS
    [Documentation]    Verify simulate runs dry-run context assembly via ACMS
    [Tags]    tdd_issue    tdd_issue_4313    tdd_expected_fail

    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    simulate-wired    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-simulate-wired-ok

Context Set ACMS Pipeline Options
    [Documentation]    Verify context set persists ACMS pipeline configuration
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    set-acms    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-set-acms-ok

Context Show ACMS Pipeline Config
    [Documentation]    Verify context show displays ACMS pipeline configuration
    [Tags]    tdd_issue    tdd_issue_4313    tdd_expected_fail

    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    show-acms    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    context-show-acms-ok
