*** Settings ***
Documentation    Integration tests for tool-add persistence (issue #621)
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Tool Add Then List Shows Tool
    [Documentation]    Verify that a tool added via the repository is visible
    ...    from a brand-new session against the same file database.
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    add-then-list    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tool-persist-add-then-list-ok

Tool List On Fresh Init Shows No Tools
    [Documentation]    Verify that listing tools on a newly created
    ...    database returns an empty set.
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    fresh-list-empty    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tool-persist-fresh-list-empty-ok
