*** Settings ***
Documentation    Integration smoke tests for DomainBaseModel refactor.
...
...              Verifies that extracting the shared model_config into
...              DomainBaseModel has not changed the observable behaviour of
...              any affected domain model class.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
DomainBaseModel Is Importable
    [Documentation]    DomainBaseModel can be imported and is a pydantic BaseModel subclass
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    importable    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    domain-base-model-importable-ok

DomainBaseModel Carries Expected Config
    [Documentation]    DomainBaseModel model_config has all expected settings
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    config    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    domain-base-model-config-ok

ModelProviderOption Behaviour Unchanged
    [Documentation]    ModelProviderOption works correctly after inheriting from DomainBaseModel
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    model-provider-option    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    model-provider-option-ok

ModelError Behaviour Unchanged
    [Documentation]    ModelError works correctly after inheriting from DomainBaseModel
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    model-error    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    model-error-ok

FallbackResult Behaviour Unchanged
    [Documentation]    FallbackResult works correctly after inheriting from DomainBaseModel
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    fallback-result    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    fallback-result-ok

Auth Models Behaviour Unchanged
    [Documentation]    All auth domain models work correctly after inheriting from DomainBaseModel
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    auth-models    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    auth-models-ok

PlanConfig Models Behaviour Unchanged
    [Documentation]    PlanConfig and ConfigSetting work correctly after inheriting from DomainBaseModel
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    plan-config-models    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    plan-config-models-ok

Whitespace Stripping Active On Refactored Models
    [Documentation]    str_strip_whitespace config is active on all refactored models
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    whitespace-stripping    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    whitespace-stripping-ok
