*** Settings ***
Documentation    TDD Issue #570 — session create DI container missing db provider
...              Integration smoke tests verifying that the session create command
...              fails due to the DI container lacking a ``db`` provider.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
TDD Session Create DI Error Via CLI
    [Documentation]    Verify that ``session create`` triggers the DI db error
    [Tags]  tdd_issue    tdd_issue_570    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-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-create-di-error-ok

TDD Session Create With Actor DI Error
    [Documentation]    Verify that ``session create --actor`` triggers the DI db error
    [Tags]  tdd_issue    tdd_issue_570    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-actor    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-create-actor-ok

TDD Session Create DI JSON Output
    [Documentation]    Verify that ``session create --format json`` fails due to DI db error
    [Tags]  tdd_issue    tdd_issue_570    tdd_issue_4178
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-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-create-json-ok
