# Path: ceagle/app.py
# def versions():
# def not_found(error):
# def handle_unknown_service(ex):
# 
# Path: ceagle/config.py
# DEFAULT_CONF_PATH = "/etc/ceagle/config.yaml"
# DEFAULT = {
#     "use_fake_api_data": True,
#     "services": {},
# }
# SCHEMA = {
#     "use_fake_api_data": {"type": "boolean"},
#     "services": {
#         "type": "object",
#         "properties": {
#             "availability": {"type": "string"},
#             "capacity": {"type": "string"},
#             "cis": {"type": "string"},
#             "health": {"type": "string"},
#             "optimization": {"type": "string"},
#             "performance": {"type": "string"},
#             "security": {"type": "string"},
#             "infra": {
#                 "type": "object",
#                 "patternProperties": {
#                     "\w+": {
#                         "type": "array",
#                         "uniqueItems": True,
#                         "items": {
#                             "type": "object",
#                             "properties": {
#                                 "id": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "title": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "description": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "urls": {
#                                     "type": "array",
#                                     "items": {
#                                         "type": "array",
#                                         "items": {
#                                             "type": "string",
#                                             "minLength": 8
#                                         }
#                                     }
#                                 },
#                             },
#                             "required": ["id", "title", "description", "urls"],
#                             "additionalProperties": False,
#                         },
#                     },
#                 }
#             }
#         },
#         "additionalProperties": False,
#     },
# }


import copy
import json
import mock
import testtools
from oss_lib import config
from ceagle import app
from ceagle import config as cfg
#    License for the specific language governing permissions and limitations
#    under the License.





class TestCase(testtools.TestCase):

    def setUp(self):
        super(TestCase, self).setUp()
        self.addCleanup(mock.patch.stopall)

        app.app.config["TESTING"] = True
        self.app = app.app.test_client()

    def mock_config(self, update=None):
        patch = mock.patch("oss_lib.config._CONF")
        patch.start()
        self.addCleanup(patch.stop)

        defaults = copy.deepcopy(cfg.DEFAULT)
        if update:
            config.merge_dicts(defaults, update)
        config.setup_config(
            defaults=defaults,
            validation_schema=cfg.SCHEMA,
        )

    def post(self, *args, **kwargs):

# Path: ceagle/app.py
# def versions():
# def not_found(error):
# def handle_unknown_service(ex):
# 
# Path: ceagle/config.py
# DEFAULT_CONF_PATH = "/etc/ceagle/config.yaml"
# DEFAULT = {
#     "use_fake_api_data": True,
#     "services": {},
# }
# SCHEMA = {
#     "use_fake_api_data": {"type": "boolean"},
#     "services": {
#         "type": "object",
#         "properties": {
#             "availability": {"type": "string"},
#             "capacity": {"type": "string"},
#             "cis": {"type": "string"},
#             "health": {"type": "string"},
#             "optimization": {"type": "string"},
#             "performance": {"type": "string"},
#             "security": {"type": "string"},
#             "infra": {
#                 "type": "object",
#                 "patternProperties": {
#                     "\w+": {
#                         "type": "array",
#                         "uniqueItems": True,
#                         "items": {
#                             "type": "object",
#                             "properties": {
#                                 "id": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "title": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "description": {
#                                     "type": "string",
#                                     "minLength": 1,
#                                 },
#                                 "urls": {
#                                     "type": "array",
#                                     "items": {
#                                         "type": "array",
#                                         "items": {
#                                             "type": "string",
#                                             "minLength": 8
#                                         }
#                                     }
#                                 },
#                             },
#                             "required": ["id", "title", "description", "urls"],
#                             "additionalProperties": False,
#                         },
#                     },
#                 }
#             }
#         },
#         "additionalProperties": False,
#     },
# }


# Path: tests/unit/test.py
import copy
import json
import mock
import testtools
from oss_lib import config
from ceagle import app
from ceagle import config as cfg

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





class TestCase(testtools.TestCase):

    def setUp(self):
        super(TestCase, self).setUp()
        self.addCleanup(mock.patch.stopall)

        app.app.config["TESTING"] = True
        self.app = app.app.test_client()

    def mock_config(self, update=None):
        patch = mock.patch("oss_lib.config._CONF")
        patch.start()
        self.addCleanup(patch.stop)

        defaults = copy.deepcopy(cfg.DEFAULT)
        if update:
            config.merge_dicts(defaults, update)
        config.setup_config(
            defaults=defaults,
            validation_schema=cfg.SCHEMA,
        )

    def post(self, *args, **kwargs):

        rv = self.app.post(*args, **kwargs)