# Path: deckhand/errors.py
# LOG = logging.getLogger(__name__)
# def get_version_from_request(req):
# def format_error_resp(req,
#                       resp,
#                       status_code=falcon.HTTP_500,
#                       message="",
#                       reason=None,
#                       error_type=None,
#                       error_list=None,
#                       info_list=None):
# def default_exception_handler(ex, req, resp, params):
# def default_exception_serializer(req, resp, exception):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# class DeckhandException(Exception):
# class InvalidDocumentFormat(DeckhandException):
# class InvalidDocumentLayer(DeckhandException):
# class InvalidDocumentParent(DeckhandException):
# class IndeterminateDocumentParent(DeckhandException):
# class SubstitutionDependencyCycle(DeckhandException):
# class MissingDocumentKey(DeckhandException):
# class MissingDocumentPattern(DeckhandException):
# class InvalidDocumentReplacement(DeckhandException):
# class UnsupportedActionMethod(DeckhandException):
# class RevisionTagBadFormat(DeckhandException):
# class SubstitutionSourceDataNotFound(DeckhandException):
# class DocumentNotFound(DeckhandException):
# class RevisionNotFound(DeckhandException):
# class RevisionTagNotFound(DeckhandException):
# class ValidationNotFound(DeckhandException):
# class DuplicateDocumentExists(DeckhandException):
# class SingletonDocumentConflict(DeckhandException):
# class LayeringPolicyNotFound(DeckhandException):
# class SubstitutionSourceNotFound(DeckhandException):
# class PolicyNotAuthorized(DeckhandException):
# class BarbicanException(DeckhandException):
# class UnknownSubstitutionError(DeckhandException):
# 
# Path: deckhand/tests/test_utils.py
# def rand_uuid_hex():
# def rand_name(name='', prefix='deckhand'):
# def rand_bool():
# def rand_int(min, max):
# def rand_password(length=15):
# 
# Path: deckhand/tests/unit/db/base.py
# BASE_EXPECTED_FIELDS = ("created_at", "updated_at", "deleted_at", "deleted")
# DOCUMENT_EXPECTED_FIELDS = BASE_EXPECTED_FIELDS + (
#     "id", "schema", "name", "layer", "metadata", "data", "data_hash",
#     "metadata_hash", "revision_id", "bucket_id")
# REVISION_EXPECTED_FIELDS = ("id", "documents", "tags")
# class DocumentFixture(object):
# class TestDbBase(base.DeckhandWithDBTestCase):
#     def get_minimal_fixture(**kwargs):
#     def get_minimal_multi_fixture(count=2, **kwargs):
#     def create_documents(self, bucket_name, documents,
#                          validation_policies=None):
#     def show_document(self, **fields):
#     def create_revision(self):
#     def show_revision(self, revision_id):
#     def delete_revisions(self):
#     def list_revision_documents(self, revision_id, **filters):
#     def list_revisions(self):
#     def rollback_revision(self, revision_id):
#     def create_validation(self, revision_id, val_name, val_data):
#     def _validate_object(self, obj):
#     def validate_document(self, actual, expected=None, is_deleted=False):
#     def validate_revision(self, revision):


from deckhand import errors
from deckhand.tests import test_utils
from deckhand.tests.unit.db import base
            bucket_name, documents)
        new_revision_id = updated_documents[0]['revision_id']

        # 4 documents should be returned: the updated doc along with the other
        # 3 documents (unchanged) that accompanied the PUT request.
        self.assertEqual(4, len(updated_documents))
        self.assertEqual(created_documents[-1]['bucket_id'],
                         updated_documents[0]['bucket_id'])
        self.assertNotEqual(created_documents[-1]['revision_id'],
                            updated_documents[0]['revision_id'])

        revision_documents = self.list_revision_documents(
            updated_documents[0]['revision_id'])
        revision_documents = sorted(revision_documents,
                                    key=lambda d: d['created_at'])
        self.assertEqual(4, len(revision_documents))

        self.assertEqual([orig_revision_id] * 3 + [new_revision_id],
                         [d['revision_id'] for d in revision_documents])

        self.assertEqual(
            [(d['name'], d['schema'])
             for d in (created_documents[:-1] + [updated_documents[-1]])],
            [(d['name'], d['schema']) for d in revision_documents])

    def test_recreate_with_no_changes(self):
        # Verify that showing and listing revisions returns the revisions
        # with the original revision ID. This is because nothing has changed
        # so the "new" revision is just a carry-over from the original one.
        documents = base.DocumentFixture.get_minimal_fixture()

# Path: deckhand/errors.py
# LOG = logging.getLogger(__name__)
# def get_version_from_request(req):
# def format_error_resp(req,
#                       resp,
#                       status_code=falcon.HTTP_500,
#                       message="",
#                       reason=None,
#                       error_type=None,
#                       error_list=None,
#                       info_list=None):
# def default_exception_handler(ex, req, resp, params):
# def default_exception_serializer(req, resp, exception):
#     def __init__(self, message=None, **kwargs):
#     def format_message(self):
# class DeckhandException(Exception):
# class InvalidDocumentFormat(DeckhandException):
# class InvalidDocumentLayer(DeckhandException):
# class InvalidDocumentParent(DeckhandException):
# class IndeterminateDocumentParent(DeckhandException):
# class SubstitutionDependencyCycle(DeckhandException):
# class MissingDocumentKey(DeckhandException):
# class MissingDocumentPattern(DeckhandException):
# class InvalidDocumentReplacement(DeckhandException):
# class UnsupportedActionMethod(DeckhandException):
# class RevisionTagBadFormat(DeckhandException):
# class SubstitutionSourceDataNotFound(DeckhandException):
# class DocumentNotFound(DeckhandException):
# class RevisionNotFound(DeckhandException):
# class RevisionTagNotFound(DeckhandException):
# class ValidationNotFound(DeckhandException):
# class DuplicateDocumentExists(DeckhandException):
# class SingletonDocumentConflict(DeckhandException):
# class LayeringPolicyNotFound(DeckhandException):
# class SubstitutionSourceNotFound(DeckhandException):
# class PolicyNotAuthorized(DeckhandException):
# class BarbicanException(DeckhandException):
# class UnknownSubstitutionError(DeckhandException):
# 
# Path: deckhand/tests/test_utils.py
# def rand_uuid_hex():
# def rand_name(name='', prefix='deckhand'):
# def rand_bool():
# def rand_int(min, max):
# def rand_password(length=15):
# 
# Path: deckhand/tests/unit/db/base.py
# BASE_EXPECTED_FIELDS = ("created_at", "updated_at", "deleted_at", "deleted")
# DOCUMENT_EXPECTED_FIELDS = BASE_EXPECTED_FIELDS + (
#     "id", "schema", "name", "layer", "metadata", "data", "data_hash",
#     "metadata_hash", "revision_id", "bucket_id")
# REVISION_EXPECTED_FIELDS = ("id", "documents", "tags")
# class DocumentFixture(object):
# class TestDbBase(base.DeckhandWithDBTestCase):
#     def get_minimal_fixture(**kwargs):
#     def get_minimal_multi_fixture(count=2, **kwargs):
#     def create_documents(self, bucket_name, documents,
#                          validation_policies=None):
#     def show_document(self, **fields):
#     def create_revision(self):
#     def show_revision(self, revision_id):
#     def delete_revisions(self):
#     def list_revision_documents(self, revision_id, **filters):
#     def list_revisions(self):
#     def rollback_revision(self, revision_id):
#     def create_validation(self, revision_id, val_name, val_data):
#     def _validate_object(self, obj):
#     def validate_document(self, actual, expected=None, is_deleted=False):
#     def validate_revision(self, revision):


# Path: deckhand/tests/unit/db/test_revisions.py
from deckhand import errors
from deckhand.tests import test_utils
from deckhand.tests.unit.db import base

            bucket_name, documents)
        new_revision_id = updated_documents[0]['revision_id']

        # 4 documents should be returned: the updated doc along with the other
        # 3 documents (unchanged) that accompanied the PUT request.
        self.assertEqual(4, len(updated_documents))
        self.assertEqual(created_documents[-1]['bucket_id'],
                         updated_documents[0]['bucket_id'])
        self.assertNotEqual(created_documents[-1]['revision_id'],
                            updated_documents[0]['revision_id'])

        revision_documents = self.list_revision_documents(
            updated_documents[0]['revision_id'])
        revision_documents = sorted(revision_documents,
                                    key=lambda d: d['created_at'])
        self.assertEqual(4, len(revision_documents))

        self.assertEqual([orig_revision_id] * 3 + [new_revision_id],
                         [d['revision_id'] for d in revision_documents])

        self.assertEqual(
            [(d['name'], d['schema'])
             for d in (created_documents[:-1] + [updated_documents[-1]])],
            [(d['name'], d['schema']) for d in revision_documents])

    def test_recreate_with_no_changes(self):
        # Verify that showing and listing revisions returns the revisions
        # with the original revision ID. This is because nothing has changed
        # so the "new" revision is just a carry-over from the original one.
        documents = base.DocumentFixture.get_minimal_fixture()

        bucket_name = test_utils.rand_name('bucket')