# 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

        mock_request.assert_called_with('GET',
                                        'http://fake.com',
                                        kwarg1='a kwarg',
                                        kwarg2='another kwarg')

    def test_get_sleeps_correctly_on_503(self):
        _request_and_assert(
            lambda: requests_with_backoff.get('http://fake.com',
                                              kwarg1='a kwarg',
                                              kwarg2='another kwarg'),
            call('GET',
                 'http://fake.com',
                 kwarg1='a kwarg',
                 kwarg2='another kwarg'),
            503)

    def test_get_sleeps_correctly_on_502(self):
        _request_and_assert(
            lambda: requests_with_backoff.get('http://fake.com',
                                              kwarg1='a kwarg',
                                              kwarg2='another kwarg'),
            call('GET',
                 'http://fake.com',
                 kwarg1='a kwarg',
                 kwarg2='another kwarg'),
            502)

    def test_get_sleeps_correctly_on_403(self):
        _request_and_assert(

# 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


        mock_request.assert_called_with('GET',
                                        'http://fake.com',
                                        kwarg1='a kwarg',
                                        kwarg2='another kwarg')

    def test_get_sleeps_correctly_on_503(self):
        _request_and_assert(
            lambda: requests_with_backoff.get('http://fake.com',
                                              kwarg1='a kwarg',
                                              kwarg2='another kwarg'),
            call('GET',
                 'http://fake.com',
                 kwarg1='a kwarg',
                 kwarg2='another kwarg'),
            503)

    def test_get_sleeps_correctly_on_502(self):
        _request_and_assert(
            lambda: requests_with_backoff.get('http://fake.com',
                                              kwarg1='a kwarg',
                                              kwarg2='another kwarg'),
            call('GET',
                 'http://fake.com',
                 kwarg1='a kwarg',
                 kwarg2='another kwarg'),
            502)

    def test_get_sleeps_correctly_on_403(self):
        _request_and_assert(

            lambda: requests_with_backoff.get('http://fake.com',