# 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
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestClientHTTPBasicAuth(base.BaseTestCase):

    auth_way = 'basic'
    scheme = 'http'

    def setUp(self):
        super(TestClientHTTPBasicAuth, self).setUp()
        conf = ceilometer_service.prepare_service(argv=[], config_files=[])
        self.CONF = self.useFixture(config_fixture.Config(conf)).conf
        self.parsed_url = urllib.parse.urlparse(
            'http://127.0.0.1:8080/controller/statistics?'
            'auth=%s&user=admin&password=admin_pass&'
            'scheme=%s' % (self.auth_way, self.scheme))
        self.params = urllib.parse.parse_qs(self.parsed_url.query)
        self.endpoint = urllib.parse.urlunparse(
            urllib.parse.ParseResult(self.scheme,
                                     self.parsed_url.netloc,
                                     self.parsed_url.path,
                                     None, None, None))
        odl_params = {'auth': self.params.get('auth')[0],
                      'user': self.params.get('user')[0],
                      'password': self.params.get('password')[0]}

# 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

# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestClientHTTPBasicAuth(base.BaseTestCase):

    auth_way = 'basic'
    scheme = 'http'

    def setUp(self):
        super(TestClientHTTPBasicAuth, self).setUp()
        conf = ceilometer_service.prepare_service(argv=[], config_files=[])
        self.CONF = self.useFixture(config_fixture.Config(conf)).conf
        self.parsed_url = urllib.parse.urlparse(
            'http://127.0.0.1:8080/controller/statistics?'
            'auth=%s&user=admin&password=admin_pass&'
            'scheme=%s' % (self.auth_way, self.scheme))
        self.params = urllib.parse.parse_qs(self.parsed_url.query)
        self.endpoint = urllib.parse.urlunparse(
            urllib.parse.ParseResult(self.scheme,
                                     self.parsed_url.netloc,
                                     self.parsed_url.path,
                                     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)