# Path: ceagle/api/client.py
# CONF = config.CONF
# FAKE_CLIENT_MAP = {
#     "security": security.Client,
# }
# class UnknownService(Exception):
# class Client(base.Client):
#     def get(self, uri="/", **kwargs):
# def get_client(service_name):
# 
# Path: tests/unit/test.py
# class TestCase(testtools.TestCase):
#     def setUp(self):
#     def mock_config(self, update=None):
#     def post(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def get(self, *args, **kwargs):


import mock
from ceagle.api import client
from tests.unit import test  # noqa
        mock_requests_get.return_value.status_code = "foo_status"
        mock_requests_get.return_value.json.return_value = {"foo": 42}
        ct = client.Client("foo", "http://foo_ep")
        result = ct.get()
        mock_requests_get.assert_called_once_with("http://foo_ep/")
        self.assertEqual(({"foo": 42}, "foo_status"), result)

        mock_requests_get.reset_mock()

    @mock.patch("ceagle.api.client.requests.get")
    def test_get_with_path(self, mock_requests_get):
        mock_requests_get.return_value.json.return_value = {"foo": 42}
        mock_requests_get.return_value.status_code = 200
        ct = client.Client("foo", "http://foo_ep")
        result = ct.get("/bar")
        mock_requests_get.assert_called_once_with("http://foo_ep/bar")
        self.assertEqual(({"foo": 42}, 200), result)

    @mock.patch("ceagle.api.client.requests.get")
    def test_get_wrong_response_fmt(self, mock_requests_get):
        mock_requests_get.return_value.json.side_effect = ValueError
        ct = client.Client("foo", "http://foo_ep")
        result = ct.get("/bar")
        self.assertEqual(
            ({"error": {"message": "Response can not be decoded"}}, 500),
            result)

    @mock.patch("ceagle.api.client.requests.get")
    def test_get_not_available(self, mock_requests_get):
        mock_requests_get.side_effect = (

# Path: ceagle/api/client.py
# CONF = config.CONF
# FAKE_CLIENT_MAP = {
#     "security": security.Client,
# }
# class UnknownService(Exception):
# class Client(base.Client):
#     def get(self, uri="/", **kwargs):
# def get_client(service_name):
# 
# Path: tests/unit/test.py
# class TestCase(testtools.TestCase):
#     def setUp(self):
#     def mock_config(self, update=None):
#     def post(self, *args, **kwargs):
#     def put(self, *args, **kwargs):
#     def delete(self, *args, **kwargs):
#     def get(self, *args, **kwargs):


# Path: tests/unit/api/test_client.py
import mock
from ceagle.api import client
from tests.unit import test  # noqa

        mock_requests_get.return_value.status_code = "foo_status"
        mock_requests_get.return_value.json.return_value = {"foo": 42}
        ct = client.Client("foo", "http://foo_ep")
        result = ct.get()
        mock_requests_get.assert_called_once_with("http://foo_ep/")
        self.assertEqual(({"foo": 42}, "foo_status"), result)

        mock_requests_get.reset_mock()

    @mock.patch("ceagle.api.client.requests.get")
    def test_get_with_path(self, mock_requests_get):
        mock_requests_get.return_value.json.return_value = {"foo": 42}
        mock_requests_get.return_value.status_code = 200
        ct = client.Client("foo", "http://foo_ep")
        result = ct.get("/bar")
        mock_requests_get.assert_called_once_with("http://foo_ep/bar")
        self.assertEqual(({"foo": 42}, 200), result)

    @mock.patch("ceagle.api.client.requests.get")
    def test_get_wrong_response_fmt(self, mock_requests_get):
        mock_requests_get.return_value.json.side_effect = ValueError
        ct = client.Client("foo", "http://foo_ep")
        result = ct.get("/bar")
        self.assertEqual(
            ({"error": {"message": "Response can not be decoded"}}, 500),
            result)

    @mock.patch("ceagle.api.client.requests.get")
    def test_get_not_available(self, mock_requests_get):
        mock_requests_get.side_effect = (

            client.requests.exceptions.ConnectionError)