# 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
    Remove the parent relationship of a Department.
    :param sqlalchemy.orm.session.Session dbsession: pytest fixture for database session
    :param list(str) testdata: pytest fixture listing test data tokens.
    """
    resource = ParentRelationship()
    response = resource.get(20)
    assert response == {'data': {'id': '10', 'type': 'departments'},
                        'links': {'related': '/departments/20/parent',
                                  'self': '/departments/20/relationships/parent'}}

    # Change parent from 10 to None
    patch_data = {'data': None}
    response, code = resource.patch(20, patch_data)
    assert response is None
    assert code == 204

    response = resource.get(20)
    assert response == {'data': None,
                        'links': {'related': '/departments/20/parent',
                                  'self': '/departments/20/relationships/parent'}}

def test_update_one_type_mismatch_relationship(dbsession, testdata):  # pylint: disable=unused-argument,redefined-outer-name,invalid-name
    """
    Raise a Conflict exception when the relationship type doesn't match schema for relationship.
    :param sqlalchemy.orm.session.Session dbsession: pytest fixture for database session
    :param list(str) testdata: pytest fixture listing test data tokens.
    """
    resource = ParentRelationship()

    patch_data = {'data': {'id': '10', 'type': 'bad-type'}}

# 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_relationships.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

    Remove the parent relationship of a Department.
    :param sqlalchemy.orm.session.Session dbsession: pytest fixture for database session
    :param list(str) testdata: pytest fixture listing test data tokens.
    """
    resource = ParentRelationship()
    response = resource.get(20)
    assert response == {'data': {'id': '10', 'type': 'departments'},
                        'links': {'related': '/departments/20/parent',
                                  'self': '/departments/20/relationships/parent'}}

    # Change parent from 10 to None
    patch_data = {'data': None}
    response, code = resource.patch(20, patch_data)
    assert response is None
    assert code == 204

    response = resource.get(20)
    assert response == {'data': None,
                        'links': {'related': '/departments/20/parent',
                                  'self': '/departments/20/relationships/parent'}}

def test_update_one_type_mismatch_relationship(dbsession, testdata):  # pylint: disable=unused-argument,redefined-outer-name,invalid-name
    """
    Raise a Conflict exception when the relationship type doesn't match schema for relationship.
    :param sqlalchemy.orm.session.Session dbsession: pytest fixture for database session
    :param list(str) testdata: pytest fixture listing test data tokens.
    """
    resource = ParentRelationship()

    patch_data = {'data': {'id': '10', 'type': 'bad-type'}}

    with pytest.raises(Conflict):