# Path: flask_restless/views/base.py
# JSONAPI_MIMETYPE = 'application/vnd.api+json'
# 
# Path: tests/helpers.py
# MSIE8_UA = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'
# MSIE9_UA = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'
# IS_PYTHON2 = (sys.version_info[0] == 2)
# CLASS_TYPES = (types.TypeType, types.ClassType) if IS_PYTHON2 else (type, )
# GLOBAL_FUNCS = [model_for, url_for, collection_name, serializer_for,
#                 primary_key_for]
# class raise_s_exception(DefaultSerializer):
# class raise_d_exception(DefaultDeserializer):
# class GUID(TypeDecorator):
# class BetterJSONEncoder(json.JSONEncoder):
# class FlaskTestBase(TestCase):
# class DatabaseMixin(object):
# class FlaskSQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class SQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class ManagerTestBase(SQLAlchemyTestBase):
#     def serialize(self, instance, *args, **kw):
#     def serialize_many(self, instances, *args, **kw):
#     def deserialize(self, *args, **kw):
#     def deserialize_many(self, *args, **kw):
# def isclass(obj):
# def parse_version(version_string):
# def unregister_fsa_session_signals():
# def check_sole_error(response, status, strings):
# def force_content_type_jsonapi(test_client):
#     def set_content_type(func):
#         def new_func(*args, **kw):
#     def load_dialect_impl(self, dialect):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def default(self, obj):
#     def setUp(self):
#     def database_uri(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
# 
# Path: tests/helpers.py
# class ManagerTestBase(SQLAlchemyTestBase):
#     """Base class for tests that use a SQLAlchemy database and an
#     :class:`~flask_restless.APIManager`.
# 
#     Nearly all test classes should subclass this class. Since we strive
#     to make Flask-Restless compliant with plain old SQLAlchemy first,
#     the default database abstraction layer used by tests in this class
#     will be SQLAlchemy. Test classes requiring Flask-SQLAlchemy must
#     instantiate their own :class:`~flask_restless.APIManager`.
# 
#     The :class:`~flask_restless.APIManager` instance for use in
#     tests is accessible at ``self.manager``.
# 
#     """
# 
#     def setUp(self):
#         """Initializes an instance of
#         :class:`~flask_restless.APIManager` with a SQLAlchemy
#         session.
# 
#         """
#         super(ManagerTestBase, self).setUp()
#         self.manager = APIManager(self.flaskapp, session=self.session)
# 
#     # HACK If we don't include this, there seems to be an issue with the
#     # globally known APIManager objects not being cleared after every test.
#     def tearDown(self):
#         """Clear the :class:`~flask_restless.APIManager` objects
#         known by the global helper functions :data:`model_for`,
#         :data:`url_for`, etc.
# 
#         """
#         super(ManagerTestBase, self).tearDown()
#         for func in GLOBAL_FUNCS:
#             func.created_managers.clear()


from unittest2 import skip
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import Unicode
from flask_restless import JSONAPI_MIMETYPE
from .helpers import loads
from .helpers import ManagerTestBase

        """
        super(TestMetadata, self).setUp()

        class Person(self.Base):
            __tablename__ = 'person'
            id = Column(Integer, primary_key=True)
            name = Column(Unicode)

        self.Person = Person
        self.Base.metadata.create_all()

    def test_total(self):
        """Tests that a request for (a subset of) all instances of a model
        includes the total number of results as part of the JSON response.

        """
        people = [self.Person() for n in range(15)]
        self.session.add_all(people)
        self.session.commit()
        self.manager.create_api(self.Person)
        response = self.app.get('/api/person')
        document = loads(response.data)
        assert document['meta']['total'] == 15

    @skip('Not sure whether this should be implemented')
    def test_http_headers(self):
        """Tests that HTTP headers appear as elements in the JSON metadata."""
        self.manager.create_api(self.Person)
        response = self.app.get('/api/person')

# Path: flask_restless/views/base.py
# JSONAPI_MIMETYPE = 'application/vnd.api+json'
# 
# Path: tests/helpers.py
# MSIE8_UA = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)'
# MSIE9_UA = 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)'
# IS_PYTHON2 = (sys.version_info[0] == 2)
# CLASS_TYPES = (types.TypeType, types.ClassType) if IS_PYTHON2 else (type, )
# GLOBAL_FUNCS = [model_for, url_for, collection_name, serializer_for,
#                 primary_key_for]
# class raise_s_exception(DefaultSerializer):
# class raise_d_exception(DefaultDeserializer):
# class GUID(TypeDecorator):
# class BetterJSONEncoder(json.JSONEncoder):
# class FlaskTestBase(TestCase):
# class DatabaseMixin(object):
# class FlaskSQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class SQLAlchemyTestBase(FlaskTestBase, DatabaseMixin):
# class ManagerTestBase(SQLAlchemyTestBase):
#     def serialize(self, instance, *args, **kw):
#     def serialize_many(self, instances, *args, **kw):
#     def deserialize(self, *args, **kw):
#     def deserialize_many(self, *args, **kw):
# def isclass(obj):
# def parse_version(version_string):
# def unregister_fsa_session_signals():
# def check_sole_error(response, status, strings):
# def force_content_type_jsonapi(test_client):
#     def set_content_type(func):
#         def new_func(*args, **kw):
#     def load_dialect_impl(self, dialect):
#     def process_bind_param(self, value, dialect):
#     def process_result_value(self, value, dialect):
#     def default(self, obj):
#     def setUp(self):
#     def database_uri(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
#     def setUp(self):
#     def tearDown(self):
# 
# Path: tests/helpers.py
# class ManagerTestBase(SQLAlchemyTestBase):
#     """Base class for tests that use a SQLAlchemy database and an
#     :class:`~flask_restless.APIManager`.
# 
#     Nearly all test classes should subclass this class. Since we strive
#     to make Flask-Restless compliant with plain old SQLAlchemy first,
#     the default database abstraction layer used by tests in this class
#     will be SQLAlchemy. Test classes requiring Flask-SQLAlchemy must
#     instantiate their own :class:`~flask_restless.APIManager`.
# 
#     The :class:`~flask_restless.APIManager` instance for use in
#     tests is accessible at ``self.manager``.
# 
#     """
# 
#     def setUp(self):
#         """Initializes an instance of
#         :class:`~flask_restless.APIManager` with a SQLAlchemy
#         session.
# 
#         """
#         super(ManagerTestBase, self).setUp()
#         self.manager = APIManager(self.flaskapp, session=self.session)
# 
#     # HACK If we don't include this, there seems to be an issue with the
#     # globally known APIManager objects not being cleared after every test.
#     def tearDown(self):
#         """Clear the :class:`~flask_restless.APIManager` objects
#         known by the global helper functions :data:`model_for`,
#         :data:`url_for`, etc.
# 
#         """
#         super(ManagerTestBase, self).tearDown()
#         for func in GLOBAL_FUNCS:
#             func.created_managers.clear()


# Path: tests/test_metadata.py
from unittest2 import skip
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import Unicode
from flask_restless import JSONAPI_MIMETYPE
from .helpers import loads
from .helpers import ManagerTestBase


        """
        super(TestMetadata, self).setUp()

        class Person(self.Base):
            __tablename__ = 'person'
            id = Column(Integer, primary_key=True)
            name = Column(Unicode)

        self.Person = Person
        self.Base.metadata.create_all()

    def test_total(self):
        """Tests that a request for (a subset of) all instances of a model
        includes the total number of results as part of the JSON response.

        """
        people = [self.Person() for n in range(15)]
        self.session.add_all(people)
        self.session.commit()
        self.manager.create_api(self.Person)
        response = self.app.get('/api/person')
        document = loads(response.data)
        assert document['meta']['total'] == 15

    @skip('Not sure whether this should be implemented')
    def test_http_headers(self):
        """Tests that HTTP headers appear as elements in the JSON metadata."""
        self.manager.create_api(self.Person)
        response = self.app.get('/api/person')

        document = loads(response.data)