<commit_before>*** Settings ***
Default Tags      pybot   jybot
Test Teardown   Close All Connections
Resource        resources/ssh_library_resources.txt

*** Test Cases ***
Test Opening And Closing Connection
    [Setup]  Open Connection  ${HOST}
    Login  ${USERNAME}  ${PASSWORD}

Switch Connection
    ${id1} =  Open Connection  ${HOST}
    Login  ${USERNAME}  ${PASSWORD}
    Write  cd /tmp
    Read Until Prompt
    ${id2} =  Open Connection  ${HOST}  second
    Login  ${USERNAME}  ${PASSWORD}
    ${prev id} =  Switch Connection  ${id1}
    Should Be Equal  ${prev id}  ${id2}
    Write  pwd
    ${result} =  Read Until Prompt
    Should Contain  ${result}  /tmp
    ${prev id} =  Switch Connection  second
    Write  pwd
    ${result} =  Read Until Prompt
    Should Contain  ${result}  /home

Login Returns Banner Value
    [Setup]  Open Connection  ${HOST}
    ${ret}=  Login  ${USERNAME}  ${PASSWORD}
    Should Contain  ${ret}  Last login

Enable Logging
    [Tags]    pybot
    [Setup]  Remove File  ${OUTPUTDIR}/sshlog.txt
    Enable SSH Logging  ${OUTPUTDIR}/sshlog.txt
    Open Connection  ${HOST}
    Login  ${username}  ${password}
    File Should Not Be Empty  ${OUTPUTDIR}/sshlog.txt

Executing Command Before Opening Connection
    Run Keyword And Expect Error  No open connection  Execute Command  ls

Get Connections
    Open Connection   ${HOST}   prompt=>>
    Open Connection   ${HOST}   alias=saila
    ${conns} =   Get Connections
    Should Be Equal    ${conns[0].host}    ${HOST}
    Should Be Equal    ${conns[1].host}    ${HOST}
    Should Be Equal    ${conns[0].prompt}    >>
    Should Be Equal    ${conns[1].alias}    saila
    Should Be Equal    ${conns[0].term_type}    vt100
<commit_msg>Fixed connection and login tests<commit_after>*** Settings ***
Default Tags      pybot   jybot
Test Teardown   Close All Connections
Resource        resources/ssh_library_resources.txt

*** Test Cases ***
Test Opening And Closing Connection
    [Setup]  Open Connection  ${HOST}
    Login  ${USERNAME}  ${PASSWORD}

Switch Connection
    ${id1} =  Open Connection  ${HOST}
    Login  ${USERNAME}  ${PASSWORD}
    Write  cd /tmp
    Read Until Prompt
    ${id2} =  Open Connection  ${HOST}  second
    Login  ${USERNAME}  ${PASSWORD}
    ${prev id} =  Switch Connection  ${id1}
    Should Be Equal  ${prev id}  ${id2}
    Write  pwd
    ${result} =  Read Until Prompt
    Should Contain  ${result}  /tmp
    ${prev id} =  Switch Connection  second
    Write  pwd
    ${result} =  Read Until Prompt
    Should Contain  ${result}  ~

Login Returns Banner Value
    [Setup]  Open Connection  ${HOST}
    ${ret}=  Login  ${USERNAME}  ${PASSWORD}
    Should Contain  ${ret}  Last login

Enable Logging
    [Tags]    pybot
    [Setup]  Remove File  ${OUTPUTDIR}/sshlog.txt
    Enable SSH Logging  ${OUTPUTDIR}/sshlog.txt
    Open Connection  ${HOST}
    Login  ${username}  ${password}
    File Should Not Be Empty  ${OUTPUTDIR}/sshlog.txt

Executing Command Before Opening Connection
    Run Keyword And Expect Error  No open connection.  Execute Command  ls

Get Connections
    Open Connection   ${HOST}   prompt=>>
    Open Connection   ${HOST}   alias=saila
    ${conns} =   Get Connections
    Should Be Equal    ${conns[0].host}    ${HOST}
    Should Be Equal    ${conns[1].host}    ${HOST}
    Should Be Equal    ${conns[0].prompt}    >>
    Should Be Equal    ${conns[1].alias}    saila
    Should Be Equal    ${conns[0].term_type}    vt100

{'fraction_non_alphanumeric': 0.10749279538904899, 'fraction_numerical': 0.0069164265129683, 'mean_word_length': 2.7769314472252447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7197180', 'n_tokens_mistral': 1125, 'n_tokens_neox': 1084, 'n_words': 363}