*** Settings ***
Documentation    Integration tests for ResourceHandler CRUD operations
...              Exercises the read -> write -> diff cycle on real
...              temporary directories and git repos.
...              Issue #827: ResourceHandler CRUD and discovery methods.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_resource_handler_crud.py

*** Test Cases ***
FsDirectory Read Write Diff Cycle
    [Documentation]    FsDirectoryHandler: read original, write modified, diff detects change
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    fs-read-write-diff    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    fs-read-write-diff-ok

GitCheckout Read Write Diff Cycle
    [Documentation]    GitCheckoutHandler: read tracked file, write change, diff detects change
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    git-read-write-diff    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    git-read-write-diff-ok
