# 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.tests import test_utils
from deckhand.tests.unit.db import base
        for storage_policy in ['cleartext', 'cleartext']:
            document = base.DocumentFixture.get_minimal_fixture()
            document['metadata']['storagePolicy'] = storage_policy
            bucket_name = test_utils.rand_name('bucket')
            created_documents = self.create_documents(bucket_name, document)
            all_created_documents.extend(created_documents)

            retrieved_documents = self.list_revision_documents(
                created_documents[0]['revision_id'],
                **{'metadata.storagePolicy': ['cleartext', 'encrypted']})
            retrieved_documents = sorted(retrieved_documents,
                                         key=lambda d: d['created_at'])

            self.assertEqual([d['id'] for d in all_created_documents],
                             [d['id'] for d in retrieved_documents])

    def test_revision_document_filtering_single_item_list_exclude_all(self):
        documents = base.DocumentFixture.get_minimal_multi_fixture(count=3)
        # If not provided, Deckhand defaults to 'cleartext'.
        for document in documents:
            document['metadata']['storagePolicy'] = None
        bucket_name = test_utils.rand_name('bucket')
        created_documents = self.create_documents(bucket_name, documents)

        retrieved_documents = self.list_revision_documents(
            created_documents[0]['revision_id'],
            **{'metadata.storagePolicy': ['encrypted']})
        self.assertEmpty(retrieved_documents)

    def test_revision_document_filtering_single_item_list_exclude_many(self):

# 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_revision_documents.py
from deckhand.tests import test_utils
from deckhand.tests.unit.db import base

        for storage_policy in ['cleartext', 'cleartext']:
            document = base.DocumentFixture.get_minimal_fixture()
            document['metadata']['storagePolicy'] = storage_policy
            bucket_name = test_utils.rand_name('bucket')
            created_documents = self.create_documents(bucket_name, document)
            all_created_documents.extend(created_documents)

            retrieved_documents = self.list_revision_documents(
                created_documents[0]['revision_id'],
                **{'metadata.storagePolicy': ['cleartext', 'encrypted']})
            retrieved_documents = sorted(retrieved_documents,
                                         key=lambda d: d['created_at'])

            self.assertEqual([d['id'] for d in all_created_documents],
                             [d['id'] for d in retrieved_documents])

    def test_revision_document_filtering_single_item_list_exclude_all(self):
        documents = base.DocumentFixture.get_minimal_multi_fixture(count=3)
        # If not provided, Deckhand defaults to 'cleartext'.
        for document in documents:
            document['metadata']['storagePolicy'] = None
        bucket_name = test_utils.rand_name('bucket')
        created_documents = self.create_documents(bucket_name, documents)

        retrieved_documents = self.list_revision_documents(
            created_documents[0]['revision_id'],
            **{'metadata.storagePolicy': ['encrypted']})
        self.assertEmpty(retrieved_documents)

    def test_revision_document_filtering_single_item_list_exclude_many(self):

        documents = base.DocumentFixture.get_minimal_multi_fixture(count=3)