Esempio n. 1
0
def test_accesses_onefs_connection_error(max_retry_exception_mock,
                                         onefs_client):
    """Verify that MaxRetryErrors are converted to OneFSConnectionErrors."""
    with pytest.raises(onefs.OneFSConnectionError):
        onefs.accesses_onefs(max_retry_exception_mock)(onefs_client)
Esempio n. 2
0
def test_accesses_onefs_try_again(retriable_api_exception_mock, onefs_client):
    """Verify that APIExceptions are retried appropriately."""
    mock, return_value = retriable_api_exception_mock
    assert onefs.accesses_onefs(mock)(onefs_client) == return_value
Esempio n. 3
0
def test_accesses_onefs_other(exception, onefs_client):
    """Verify that arbitrary exceptions are not caught."""
    with pytest.raises(exception):
        onefs.accesses_onefs(Mock(side_effect=exception))(onefs_client)
Esempio n. 4
0
def test_accesses_onefs_api_error(empty_api_exception_mock, onefs_client):
    """Verify that APIExceptions are converted to APIErrors."""
    with pytest.raises(onefs.APIError):
        onefs.accesses_onefs(empty_api_exception_mock)(onefs_client)