# Path: networking_odl/common/client.py
# LOG = log.getLogger(__name__)
# class OpenDaylightRestClient(object):
# class OpenDaylightRestClientGlobal(object):
#     def _check_opt(url):
#     def create_client(cls, url=None):
#     def __init__(self, url, username, password, timeout):
#     def get_resource(self, resource_type, resource_id):
#     def get(self, urlpath='', data=None):
#     def request(self, method, urlpath='', data=None):
#     def sendjson(self, method, urlpath, obj):
#     def _check_response(self, response):
#     def __init__(self):
#     def get_client(self):


from oslo_config import cfg
from oslo_config import fixture as config_fixture
from networking_odl.common import client
from neutron.tests import base
#    License for the specific language governing permissions and limitations
#    under the License.





class ClientTestCase(base.DietTestCase):
    def setUp(self):
        self.cfg = self.useFixture(config_fixture.Config())
        self.cfg.config(mechanism_drivers=[
                        'logger', 'opendaylight_v2'], group='ml2')
        super(ClientTestCase, self).setUp()

    def _set_config(self, url='http://127.0.0.1:9999', username='someuser',
                    password='somepass'):
        self.cfg.config(url=url, group='ml2_odl')
        self.cfg.config(username=username, group='ml2_odl')
        self.cfg.config(password=password, group='ml2_odl')

    def _test_missing_config(self, **kwargs):
        self._set_config(**kwargs)
        self.assertRaisesRegex(cfg.RequiredOptError,
                               r'value required for option \w+ in group '
                               r'\[ml2_odl\]',
                               client.OpenDaylightRestClient._check_opt,
                               cfg.CONF.ml2_odl.url)

    def test_valid_config(self):
        self._set_config()

# Path: networking_odl/common/client.py
# LOG = log.getLogger(__name__)
# class OpenDaylightRestClient(object):
# class OpenDaylightRestClientGlobal(object):
#     def _check_opt(url):
#     def create_client(cls, url=None):
#     def __init__(self, url, username, password, timeout):
#     def get_resource(self, resource_type, resource_id):
#     def get(self, urlpath='', data=None):
#     def request(self, method, urlpath='', data=None):
#     def sendjson(self, method, urlpath, obj):
#     def _check_response(self, response):
#     def __init__(self):
#     def get_client(self):


# Path: networking_odl/tests/unit/common/test_client.py
from oslo_config import cfg
from oslo_config import fixture as config_fixture
from networking_odl.common import client
from neutron.tests import base

#    License for the specific language governing permissions and limitations
#    under the License.





class ClientTestCase(base.DietTestCase):
    def setUp(self):
        self.cfg = self.useFixture(config_fixture.Config())
        self.cfg.config(mechanism_drivers=[
                        'logger', 'opendaylight_v2'], group='ml2')
        super(ClientTestCase, self).setUp()

    def _set_config(self, url='http://127.0.0.1:9999', username='someuser',
                    password='somepass'):
        self.cfg.config(url=url, group='ml2_odl')
        self.cfg.config(username=username, group='ml2_odl')
        self.cfg.config(password=password, group='ml2_odl')

    def _test_missing_config(self, **kwargs):
        self._set_config(**kwargs)
        self.assertRaisesRegex(cfg.RequiredOptError,
                               r'value required for option \w+ in group '
                               r'\[ml2_odl\]',
                               client.OpenDaylightRestClient._check_opt,
                               cfg.CONF.ml2_odl.url)

    def test_valid_config(self):
        self._set_config()

        client.OpenDaylightRestClient._check_opt(cfg.CONF.ml2_odl.url)