コード例 #1
0
def test_status_except1(mock_ssh):
    """
    Test if SSH Error is handled.
    """

    job = {"user": "******", "jobid": ""}

    mock_ssh.side_effect = exceptions.SSHError("OUT", "ERR")

    with pytest.raises(exceptions.SSHError):

        status(job)
コード例 #2
0
def test_status_state3(mock_ssh):
    """
    Test if job status is grabbed.
    """

    job = {"user": "******", "jobid": "22"}

    mock_ssh.return_value = (out, "", 0)

    output = status(job)

    assert output == "Queued"
コード例 #3
0
def test_status_state4(mock_ssh):
    """
    Test if job status is grabbed.
    """

    job = {"user": "******", "jobid": "3538341"}

    mock_ssh.return_value = ("", "", 0)

    output = status(job)

    assert output == "Finished"