# Path: networking_odl/ceilometer/network/statistics/opendaylight_v2/client.py
# LOG = log.getLogger(__name__)
# class _Base(object, metaclass=abc.ABCMeta):
# class OpenDaylightRESTAPIFailed(Exception):
# class SwitchStatisticsAPIClient(_Base):
# class Client(object):
#     def base_url(self):
#     def __init__(self, client):
#     def get_statistics(self):
#     def __init__(self, conf, endpoint, params):
#     def _get_req_params(self, params):
#     def _log_req(self, url):
#     def _log_res(resp):
#     def _http_request(self, url):
#     def request(self, path):


from unittest import mock
from oslo_config import fixture as config_fixture
from oslotest import base
from requests import auth as req_auth
from ceilometer.i18n import _
from ceilometer import service as ceilometer_service
from networking_odl.ceilometer.network.statistics.opendaylight_v2 import client
import urllib
                                     None, None, None))
        odl_params = {'auth': self.params.get('auth')[0],
                      'user': self.params.get('user')[0],
                      'password': self.params.get('password')[0]}
        self.client = client.Client(self.CONF, self.endpoint, odl_params)

        self.resp = mock.MagicMock()
        self.get = mock.patch('requests.Session.get',
                              return_value=self.resp).start()

        self.resp.raw.version = 1.1
        self.resp.status_code = 200
        self.resp.reason = 'OK'
        self.resp.headers = {}
        self.resp.content = 'dummy'

    def _test_request(self, method, url):
        data = method()

        call_args = self.get.call_args_list[0][0]
        call_kwargs = self.get.call_args_list[0][1]

        # check url
        real_url = url % {'scheme': self.scheme}
        self.assertEqual(real_url, call_args[0])

        # check auth parameters
        auth = call_kwargs.get('auth')
        if self.auth_way == 'digest':
            self.assertIsInstance(auth, req_auth.HTTPDigestAuth)

# Path: networking_odl/ceilometer/network/statistics/opendaylight_v2/client.py
# LOG = log.getLogger(__name__)
# class _Base(object, metaclass=abc.ABCMeta):
# class OpenDaylightRESTAPIFailed(Exception):
# class SwitchStatisticsAPIClient(_Base):
# class Client(object):
#     def base_url(self):
#     def __init__(self, client):
#     def get_statistics(self):
#     def __init__(self, conf, endpoint, params):
#     def _get_req_params(self, params):
#     def _log_req(self, url):
#     def _log_res(resp):
#     def _http_request(self, url):
#     def request(self, path):


# Path: networking_odl/tests/unit/ceilometer/network/statistics/opendaylight_v2/test_client.py
from unittest import mock
from oslo_config import fixture as config_fixture
from oslotest import base
from requests import auth as req_auth
from ceilometer.i18n import _
from ceilometer import service as ceilometer_service
from networking_odl.ceilometer.network.statistics.opendaylight_v2 import client
import urllib

                                     None, None, None))
        odl_params = {'auth': self.params.get('auth')[0],
                      'user': self.params.get('user')[0],
                      'password': self.params.get('password')[0]}
        self.client = client.Client(self.CONF, self.endpoint, odl_params)

        self.resp = mock.MagicMock()
        self.get = mock.patch('requests.Session.get',
                              return_value=self.resp).start()

        self.resp.raw.version = 1.1
        self.resp.status_code = 200
        self.resp.reason = 'OK'
        self.resp.headers = {}
        self.resp.content = 'dummy'

    def _test_request(self, method, url):
        data = method()

        call_args = self.get.call_args_list[0][0]
        call_kwargs = self.get.call_args_list[0][1]

        # check url
        real_url = url % {'scheme': self.scheme}
        self.assertEqual(real_url, call_args[0])

        # check auth parameters
        auth = call_kwargs.get('auth')
        if self.auth_way == 'digest':
            self.assertIsInstance(auth, req_auth.HTTPDigestAuth)

        else: