*** Settings ***
Documentation    Smoke tests for SafetyProfile domain model
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Load Default Safety Profile
    [Documentation]    Load the default safety profile and verify defaults
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    default    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    safety-default-ok

Load Safety Profile From Config
    [Documentation]    Load a safety profile from a config dict
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    from-config    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    safety-from-config-ok

Load Safety Profile From YAML
    [Documentation]    Load a safety profile from a YAML file
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    from-yaml    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    safety-from-yaml-ok

Safety Profile Serialization
    [Documentation]    Serialize safety profile to JSON and verify
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    serialize    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    safety-serialize-ok

Safety Profile Ref Creation
    [Documentation]    Create a SafetyProfileRef and verify
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    ref    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    safety-ref-ok

Safety Profile Summary
    [Documentation]    Print summary of safety profile capabilities
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    summary    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    summary-ok
