*** Settings ***
Documentation    Smoke tests for server client stubs and connection config
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Server Stub Client NotImplementedError
    [Documentation]    Verify StubServerClient raises NotImplementedError
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    stub-clients    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    server-stub-clients-ok

Server Connection Config Validation
    [Documentation]    Verify ServerConnectionConfig validates URLs
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    config-validation    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    server-config-validation-ok

Server Config Keys Registered
    [Documentation]    Verify server config keys are in the registry
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    config-keys    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    server-config-keys-ok

Server Mode Resolution
    [Documentation]    Verify resolve_server_mode returns disabled when no URL
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    server-mode    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    server-mode-ok

CLI Server Connect Stub
    [Documentation]    Verify CLI server connect prints stub warning
    ${result}=    Run Process    ${PYTHON}    -m    cleveragents    server    connect    https://stub.example.com    --format    json    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    not yet implemented
