# Path: models/bases.py
# NO_VALUE = sa_symbol('NO_VALUE')
# class Base(object):
# class BaseModel(Base):
#     def __repr__(self):
#     def __str__(self):
#     def __tablename__(cls):  # pylint: disable=no-self-argument
#     def delete(self):
#     def _prepare_conditions(cls, conditions):
#     def get_all(cls, conditions=None):
#     def get_by_pk(cls, the_id):
#     def save(self, flush=False):
# 
# Path: ourapi/exceptions.py
# class Conflict(JSONAPIError, werkzeug.exceptions.Conflict):
#     """ 409 Conflict: fails server unique constraint or id issues. """
#     pass
# 
# class NotFound(JSONAPIError, werkzeug.exceptions.NotFound):
#     """ 404 Not Found: Resource doesn't exist. """
#     pass


    from builtins import *  # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import
from models import bases
from ourapi.exceptions import Conflict, NotFound
    import sys
import datetime
import warnings
import marshmallow
import pytest
import sqlalchemy as sa
import ourapi
import ourmarshmallow
class HorsesResource(ourapi.JsonApiResource):
    """ JSONAPI CRUD endpoints for HorsesSchema/Horses Model. """
    schema = HorsesSchema


def test_new_detail_resource():
    """ Resource endpoint for Model details. """
    resource = HorsesResource()
    assert isinstance(resource, HorsesResource)

def test_detail_read(dbsession):  # pylint: disable=unused-argument
    """ Create a resource, and then Read it """
    now = datetime.datetime(2017, 8, 7, 18, 37, 29)
    the_model = Horses(id=10, name="foo bar baz", modified_at=now)
    the_model.save()

    resource = HorsesResource()
    response = resource.get(10)

    assert response == {'data': {'attributes': {'name': 'foo bar baz'},
                                 'id': '10',
                                 'links': {'self': '/horses/10'},
                                 'meta': {'modified_at': '2017-08-07T18:37:29+00:00'},
                                 'type': 'horses'},
                        'links': {'self': '/horses/10'}}

def test_detail_read_not_found(dbsession):  # pylint: disable=unused-argument
    """ Resource Detail Read raises NotFound when id isn't found. """
    resource = HorsesResource()


# Path: models/bases.py
# NO_VALUE = sa_symbol('NO_VALUE')
# class Base(object):
# class BaseModel(Base):
#     def __repr__(self):
#     def __str__(self):
#     def __tablename__(cls):  # pylint: disable=no-self-argument
#     def delete(self):
#     def _prepare_conditions(cls, conditions):
#     def get_all(cls, conditions=None):
#     def get_by_pk(cls, the_id):
#     def save(self, flush=False):
# 
# Path: ourapi/exceptions.py
# class Conflict(JSONAPIError, werkzeug.exceptions.Conflict):
#     """ 409 Conflict: fails server unique constraint or id issues. """
#     pass
# 
# class NotFound(JSONAPIError, werkzeug.exceptions.NotFound):
#     """ 404 Not Found: Resource doesn't exist. """
#     pass


# Path: tests/ourapi/test_resource_detail.py
    from builtins import *  # pylint: disable=unused-wildcard-import,redefined-builtin,wildcard-import
from models import bases
from ourapi.exceptions import Conflict, NotFound
    import sys
import datetime
import warnings
import marshmallow
import pytest
import sqlalchemy as sa
import ourapi
import ourmarshmallow

class HorsesResource(ourapi.JsonApiResource):
    """ JSONAPI CRUD endpoints for HorsesSchema/Horses Model. """
    schema = HorsesSchema


def test_new_detail_resource():
    """ Resource endpoint for Model details. """
    resource = HorsesResource()
    assert isinstance(resource, HorsesResource)

def test_detail_read(dbsession):  # pylint: disable=unused-argument
    """ Create a resource, and then Read it """
    now = datetime.datetime(2017, 8, 7, 18, 37, 29)
    the_model = Horses(id=10, name="foo bar baz", modified_at=now)
    the_model.save()

    resource = HorsesResource()
    response = resource.get(10)

    assert response == {'data': {'attributes': {'name': 'foo bar baz'},
                                 'id': '10',
                                 'links': {'self': '/horses/10'},
                                 'meta': {'modified_at': '2017-08-07T18:37:29+00:00'},
                                 'type': 'horses'},
                        'links': {'self': '/horses/10'}}

def test_detail_read_not_found(dbsession):  # pylint: disable=unused-argument
    """ Resource Detail Read raises NotFound when id isn't found. """
    resource = HorsesResource()


    with pytest.raises(NotFound) as excinfo: