# Path: tenable_io/client.py
# DEFAULT_PROXIES = {
#     proto: proxy for proto, proxy in {
#         'http': TenableIOConfig.get('http_proxy'),
#         'https': TenableIOConfig.get('https_proxy')
#     }.items()
#     if proxy is not None
# }
#     _MAX_RETRIES = TenableIOConfig.get('max_retries')
#     _TOTAL_RETRIES = _MAX_RETRIES if int(_MAX_RETRIES) < 5 else 5
#     _RETRY_STATUS_CODES = {429, 500, 501, 502, 503, 504}
#     _RETRY_SLEEP_MILLISECONDS = TenableIOConfig.get('retry_sleep_milliseconds')
# class TenableIOClient(object):
#     def __init__(
#             self,
#             access_key=TenableIOConfig.get('access_key'),
#             secret_key=TenableIOConfig.get('secret_key'),
#             endpoint=TenableIOConfig.get('endpoint'),
#             proxies=DEFAULT_PROXIES,
#             impersonate=None,
#     ):
#     def _init_session(self):
#     def _init_api(self):
#     def _init_helpers(self):
#     def _retry(f):
#         def wrapper(*args, **kwargs):
#     def _error_handler(f):
#         def wrapper(*args, **kwargs):
#     def impersonate(username):
#     def get(self, uri, path_params=None, **kwargs):
#     def post(self, uri, payload=None, path_params=None, **kwargs):
#     def put(self, uri, payload=None, path_params=None, **kwargs):
#     def delete(self, uri, path_params=None, **kwargs):
#     def _flatten_param(cls, params):
#     def _request(self, method, uri, path_params=None, flatten_params=True, **kwargs):


import pytest
    from unittest.mock import Mock
    from mock import Mock
from tenable_io.client import TenableIOClient, TenableIOApiException, TenableIORetryableApiException
from tests.base import BaseTest

try:
except ImportError:



class TestClient(BaseTest):

    def test_client_retries(self):
        mock_error = Mock(side_effect=TenableIORetryableApiException(Mock()))
        retry_mock_error = TenableIOClient._retry(mock_error)
        retry_header = {u'X-Tio-Retry-Count': '3'}

        with pytest.raises(TenableIOApiException):
            retry_mock_error()


# Path: tenable_io/client.py
# DEFAULT_PROXIES = {
#     proto: proxy for proto, proxy in {
#         'http': TenableIOConfig.get('http_proxy'),
#         'https': TenableIOConfig.get('https_proxy')
#     }.items()
#     if proxy is not None
# }
#     _MAX_RETRIES = TenableIOConfig.get('max_retries')
#     _TOTAL_RETRIES = _MAX_RETRIES if int(_MAX_RETRIES) < 5 else 5
#     _RETRY_STATUS_CODES = {429, 500, 501, 502, 503, 504}
#     _RETRY_SLEEP_MILLISECONDS = TenableIOConfig.get('retry_sleep_milliseconds')
# class TenableIOClient(object):
#     def __init__(
#             self,
#             access_key=TenableIOConfig.get('access_key'),
#             secret_key=TenableIOConfig.get('secret_key'),
#             endpoint=TenableIOConfig.get('endpoint'),
#             proxies=DEFAULT_PROXIES,
#             impersonate=None,
#     ):
#     def _init_session(self):
#     def _init_api(self):
#     def _init_helpers(self):
#     def _retry(f):
#         def wrapper(*args, **kwargs):
#     def _error_handler(f):
#         def wrapper(*args, **kwargs):
#     def impersonate(username):
#     def get(self, uri, path_params=None, **kwargs):
#     def post(self, uri, payload=None, path_params=None, **kwargs):
#     def put(self, uri, payload=None, path_params=None, **kwargs):
#     def delete(self, uri, path_params=None, **kwargs):
#     def _flatten_param(cls, params):
#     def _request(self, method, uri, path_params=None, flatten_params=True, **kwargs):


# Path: tests/unit/test_client.py
import pytest
    from unittest.mock import Mock
    from mock import Mock
from tenable_io.client import TenableIOClient, TenableIOApiException, TenableIORetryableApiException
from tests.base import BaseTest


try:
except ImportError:



class TestClient(BaseTest):

    def test_client_retries(self):
        mock_error = Mock(side_effect=TenableIORetryableApiException(Mock()))
        retry_mock_error = TenableIOClient._retry(mock_error)
        retry_header = {u'X-Tio-Retry-Count': '3'}

        with pytest.raises(TenableIOApiException):
            retry_mock_error()


        assert mock_error.call_count == int(TenableIOClient._TOTAL_RETRIES) + 1, \