*** Settings ***
Documentation    Smoke tests for Skill Registry persistence layer
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Register And Retrieve A Skill
    [Documentation]    Register a skill and retrieve it by name
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    register-and-get    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-registry-ok

List Skills With Namespace Filter
    [Documentation]    Register skills and list with namespace filter
    ${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}    skill-list-ok

Update A Skill
    [Documentation]    Register and update a skill description
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    update-skill    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-update-ok

Reject Duplicate Skill Name
    [Documentation]    Verify duplicate skill names are rejected
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    duplicate-reject    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-duplicate-reject-ok

Remove A Skill
    [Documentation]    Register and remove a skill
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    remove-skill    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-remove-ok
