*** Settings ***
Documentation    TDD Issue #554 — session list DI container missing db provider
...              Integration smoke tests verifying that the session list command
...              succeeds once the DI container has a proper ``db`` provider.
...              Bug #554 is now fixed; these tests serve as regression tests.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
TDD Session List DI Error Via CLI
    [Documentation]    Verify that ``session list`` succeeds via the real DI path
    [Tags]  tdd_issue    tdd_issue_554    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    list-di-error    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-session-list-di-error-ok

TDD Session List DI Service Resolution
    [Documentation]    Verify that ``_get_session_service()`` resolves a valid service
    [Tags]  tdd_issue    tdd_issue_554    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    service-resolution    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-session-list-service-resolution-ok

TDD Session List DI JSON Output
    [Documentation]    Verify that ``session list --format json`` succeeds via the real DI path
    [Tags]  tdd_issue    tdd_issue_554    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    list-json    cwd=${WORKSPACE}    timeout=120s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-session-list-json-ok
