*** Settings ***
Documentation     Integration tests for plan phase/state rebaseline migration (a5_005).
...               Verifies that the rebaselined v3_plans table accepts the Action phase
...               and Apply terminal processing states.
Resource          ${CURDIR}/common.resource
Suite Setup       Setup Test Environment
Suite Teardown    Cleanup Test Environment

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

*** Test Cases ***
Insert Plan With Action Phase And Queued State
    [Documentation]    Verify a plan with phase='action' and processing_state='queued' persists
    [Tags]    database    migration    plan_phase
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    action-queued    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    action-queued-ok

Insert Plan With Apply Phase And Applied State
    [Documentation]    Verify a plan with phase='apply' and processing_state='applied' persists
    [Tags]    database    migration    plan_phase
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    apply-applied    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    apply-applied-ok
