# Path: performanceplatform/utils/requests_with_backoff.py
# _MAX_RETRIES = 5
# def get(url, *args, **kwargs):
# def post(url, *args, **kwargs):
# def __request_with_backoff(method, url, *args, **kwargs):


from mock import patch, call
from nose.tools import assert_equal, assert_raises, assert_is
from performanceplatform.utils import requests_with_backoff
import requests
    def _response_generator(bad_status_code):
        bad_response = _make_bad_response(bad_status_code)
        good_response = _make_good_response()

        yield bad_response
        yield bad_response
        yield good_response

    mock_request.side_effect = _response_generator(status_code)
    request_call()

    assert_equal(
        [call(10), call(20)],
        mock_sleep.call_args_list)

    assert_equal(
        [expected_call,
         expected_call,
         expected_call],
        mock_request.call_args_list)


class TestRequestsWithBackoff(object):

    # tests for GET
    @patch('performanceplatform.utils.requests_with_backoff.request')
    def test_get_proxies_requests_get(self, mock_request):
        good_response = _make_good_response()
        mock_request.return_value = good_response


# Path: performanceplatform/utils/requests_with_backoff.py
# _MAX_RETRIES = 5
# def get(url, *args, **kwargs):
# def post(url, *args, **kwargs):
# def __request_with_backoff(method, url, *args, **kwargs):


# Path: tests/performanceplatform/utils/test_requests_with_backoff.py
from mock import patch, call
from nose.tools import assert_equal, assert_raises, assert_is
from performanceplatform.utils import requests_with_backoff
import requests

    def _response_generator(bad_status_code):
        bad_response = _make_bad_response(bad_status_code)
        good_response = _make_good_response()

        yield bad_response
        yield bad_response
        yield good_response

    mock_request.side_effect = _response_generator(status_code)
    request_call()

    assert_equal(
        [call(10), call(20)],
        mock_sleep.call_args_list)

    assert_equal(
        [expected_call,
         expected_call,
         expected_call],
        mock_request.call_args_list)


class TestRequestsWithBackoff(object):

    # tests for GET
    @patch('performanceplatform.utils.requests_with_backoff.request')
    def test_get_proxies_requests_get(self, mock_request):
        good_response = _make_good_response()
        mock_request.return_value = good_response


        response = requests_with_backoff.get('http://fake.com',