Ejemplo n.º 1
0
def test_client_stops_retrying_after_10_server_errors(box_client, mock_box, error_code):
    # pylint:disable=redefined-outer-name
    mock_box.get_folder_info.add_chaos(error(error_code))
    with pytest.raises(BoxAPIException) as exc_info:
        box_client.folder(0).get()
        assert exc_info.value.status == error_code
    assert len(mock_box.requests) == 14  # 3 auth requests, 1 try, and 10 retries
Ejemplo n.º 2
0
def test_client_retries_on_server_error(box_client, mock_box, error_code,
                                        should_apply):
    # pylint:disable=redefined-outer-name
    should_apply, expected_num_requests = should_apply
    mock_box.get_folder_info.add_chaos(error(error_code), should_apply)
    box_client.folder('0').get()
    assert len(mock_box.requests) == expected_num_requests
Ejemplo n.º 3
0
def test_client_retries_on_retry_after(box_client, mock_box, retry_code,
                                       should_apply):
    # pylint:disable=redefined-outer-name
    should_apply, expected_num_requests = should_apply
    mock_box.get_folder_info.add_chaos(
        error(retry_code, headers={RETRY_AFTER_HEADER: 1}), should_apply)
    box_client.folder('0').get()
    assert len(mock_box.requests) == expected_num_requests
Ejemplo n.º 4
0
def test_client_retries_on_retry_after(box_client, mock_box, retry_code, should_apply):
    # pylint:disable=redefined-outer-name
    should_apply, expected_num_requests = should_apply
    mock_box.get_folder_info.add_chaos(error(retry_code, headers={RETRY_AFTER_HEADER: 1}), should_apply)
    box_client.folder(0).get()
    assert len(mock_box.requests) == expected_num_requests
Ejemplo n.º 5
0
def test_client_retries_on_server_error(box_client, mock_box, error_code, should_apply):
    # pylint:disable=redefined-outer-name
    should_apply, expected_num_requests = should_apply
    mock_box.get_folder_info.add_chaos(error(error_code), should_apply)
    box_client.folder(0).get()
    assert len(mock_box.requests) == expected_num_requests