# Path: contrail_api_cli/context.py
# class Context(object):
#     _schema = None
#     _shell = ShellContext
#     _session = None
# 
#     @property
#     def schema(self):
#         if self._schema is None:
#             raise SchemaNotInitialized("The schema must be first initialized")
#         else:
#             return self._schema
# 
#     @schema.setter
#     def schema(self, schema):
#         self._schema = schema
# 
#     @property
#     def session(self):
#         if self._session is None:
#             raise SessionNotInitialized("The session must be first initialized")
#         else:
#             return self._session
# 
#     @session.setter
#     def session(self, session):
#         self._session = session
# 
#     @property
#     def shell(self):
#         return self._shell
# 
# Path: contrail_api_cli/schema.py
# class DummySchema(object):
# 
#     def __init__(self):
#         DummyResourceSchema()
# 
#     @property
#     def version(self):
#         return "dummy"
# 
#     def resource(self, resource_name):
#         if resource_name not in self.all_resources():
#             raise ResourceNotDefined(resource_name)
#         return DummyResourceSchema()
# 
#     def all_resources(self):
#         return DummyResourceSchema().children
# 
# class DummyResourceSchema(ResourceSchema):
# 
#     def __init__(self):
#         ResourceSchema.__init__(self)
#         # add all resource types to all link types
#         # so that LinkedResources can find linked
#         # resources in the json representation
#         self.children = self.refs = self.back_refs = \
#             [c.type for c in RootCollection(fetch=True)]


import unittest
    import mock
    import unittest.mock as mock
from contrail_api_cli.context import Context
from contrail_api_cli.schema import DummySchema, DummyResourceSchema
try:
except ImportError:



class CLITest(unittest.TestCase):

    @mock.patch('contrail_api_cli.resource.Context.session')
    def setUp(self, mock_session):
        self.maxDiff = None
        self.BASE = "http://localhost:8082"
        mock_session.configure_mock(base_url=self.BASE)
        mock_session.get_json.return_value = {
            "href": self.BASE,
            "links": [
                {"link": {"href": self.BASE + "/foos",
                          "name": "foo",
                          "rel": "collection"}},
                {"link": {"href": self.BASE + "/bars",
                          "name": "bar",
                          "rel": "collection"}},
                {"link": {"href": self.BASE + "/foobars",
                          "name": "foobar",
                          "rel": "collection"}}
            ]
        }
        DummyResourceSchema()
        Context().schema = DummySchema()

    def tearDown(self):

# Path: contrail_api_cli/context.py
# class Context(object):
#     _schema = None
#     _shell = ShellContext
#     _session = None
# 
#     @property
#     def schema(self):
#         if self._schema is None:
#             raise SchemaNotInitialized("The schema must be first initialized")
#         else:
#             return self._schema
# 
#     @schema.setter
#     def schema(self, schema):
#         self._schema = schema
# 
#     @property
#     def session(self):
#         if self._session is None:
#             raise SessionNotInitialized("The session must be first initialized")
#         else:
#             return self._session
# 
#     @session.setter
#     def session(self, session):
#         self._session = session
# 
#     @property
#     def shell(self):
#         return self._shell
# 
# Path: contrail_api_cli/schema.py
# class DummySchema(object):
# 
#     def __init__(self):
#         DummyResourceSchema()
# 
#     @property
#     def version(self):
#         return "dummy"
# 
#     def resource(self, resource_name):
#         if resource_name not in self.all_resources():
#             raise ResourceNotDefined(resource_name)
#         return DummyResourceSchema()
# 
#     def all_resources(self):
#         return DummyResourceSchema().children
# 
# class DummyResourceSchema(ResourceSchema):
# 
#     def __init__(self):
#         ResourceSchema.__init__(self)
#         # add all resource types to all link types
#         # so that LinkedResources can find linked
#         # resources in the json representation
#         self.children = self.refs = self.back_refs = \
#             [c.type for c in RootCollection(fetch=True)]


# Path: contrail_api_cli/tests/utils.py
import unittest
    import mock
    import unittest.mock as mock
from contrail_api_cli.context import Context
from contrail_api_cli.schema import DummySchema, DummyResourceSchema

try:
except ImportError:



class CLITest(unittest.TestCase):

    @mock.patch('contrail_api_cli.resource.Context.session')
    def setUp(self, mock_session):
        self.maxDiff = None
        self.BASE = "http://localhost:8082"
        mock_session.configure_mock(base_url=self.BASE)
        mock_session.get_json.return_value = {
            "href": self.BASE,
            "links": [
                {"link": {"href": self.BASE + "/foos",
                          "name": "foo",
                          "rel": "collection"}},
                {"link": {"href": self.BASE + "/bars",
                          "name": "bar",
                          "rel": "collection"}},
                {"link": {"href": self.BASE + "/foobars",
                          "name": "foobar",
                          "rel": "collection"}}
            ]
        }
        DummyResourceSchema()
        Context().schema = DummySchema()

    def tearDown(self):

        Context().schema = None