def test_get_logs_returns_false_with_value_error():
    err = "err"
    mock_spark_session = MagicMock()
    type(mock_spark_session).logs = PropertyMock(side_effect=ValueError(err))
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert not res
    assert logs_r == err
Пример #2
0
def test_get_logs_returns_false_with_value_error():
    err = "err"
    mock_spark_session = MagicMock()
    mock_spark_session.get_logs = MagicMock(side_effect=ValueError(err))
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert not res
    assert logs_r == err
def test_get_logs_returns_session_logs():
    logs = "hi"
    mock_spark_session = MagicMock()
    mock_spark_session.logs = logs
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert res
    assert logs_r == logs
Пример #4
0
def test_get_logs_returns_session_logs():
    logs = "hi"
    mock_spark_session = MagicMock()
    mock_spark_session.get_logs = MagicMock(return_value=logs)
    client = LivyClient(mock_spark_session)

    res, logs_r = client.get_logs()

    assert res
    assert logs_r == logs