# Path: deckhand/control/views/revision.py
# class ViewBuilder(common.ViewBuilder):
#     def list(self, revisions):
#     def show(self, revision):
# 
# 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.control.views import revision
from deckhand.tests import test_utils
from deckhand.tests.unit.db import base
        self.assertIn('results', revisions_view)
        # Validate that only 1 revision was returned.
        self.assertEqual(1, revisions_view['count'])
        # Validate that the first revision has 4 documents.
        self.assertIn('id', revisions_view['results'][0])

    def test_list_multiple_revisions(self):
        docs_count = []
        for _ in range(3):
            doc_count = test_utils.rand_int(3, 9)
            docs_count.append(doc_count)

            payload = [base.DocumentFixture.get_minimal_fixture()
                       for _ in range(doc_count)]
            bucket_name = test_utils.rand_name('bucket')
            self.create_documents(bucket_name, payload)
            revisions = self.list_revisions()
        revisions_view = self.view_builder.list(revisions)

        self.assertIn('results', revisions_view)
        # Validate that only 1 revision was returned.
        self.assertEqual(3, revisions_view['count'])

        # Validate that each revision has correct number of documents.
        for idx, doc_count in enumerate(docs_count):
            self.assertIn('id', revisions_view['results'][idx])

    def test_show_revision(self):
        payload = [base.DocumentFixture.get_minimal_fixture()
                   for _ in range(4)]

# Path: deckhand/control/views/revision.py
# class ViewBuilder(common.ViewBuilder):
#     def list(self, revisions):
#     def show(self, revision):
# 
# 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/views/test_revision_views.py
from deckhand.control.views import revision
from deckhand.tests import test_utils
from deckhand.tests.unit.db import base

        self.assertIn('results', revisions_view)
        # Validate that only 1 revision was returned.
        self.assertEqual(1, revisions_view['count'])
        # Validate that the first revision has 4 documents.
        self.assertIn('id', revisions_view['results'][0])

    def test_list_multiple_revisions(self):
        docs_count = []
        for _ in range(3):
            doc_count = test_utils.rand_int(3, 9)
            docs_count.append(doc_count)

            payload = [base.DocumentFixture.get_minimal_fixture()
                       for _ in range(doc_count)]
            bucket_name = test_utils.rand_name('bucket')
            self.create_documents(bucket_name, payload)
            revisions = self.list_revisions()
        revisions_view = self.view_builder.list(revisions)

        self.assertIn('results', revisions_view)
        # Validate that only 1 revision was returned.
        self.assertEqual(3, revisions_view['count'])

        # Validate that each revision has correct number of documents.
        for idx, doc_count in enumerate(docs_count):
            self.assertIn('id', revisions_view['results'][idx])

    def test_show_revision(self):
        payload = [base.DocumentFixture.get_minimal_fixture()
                   for _ in range(4)]

        bucket_name = test_utils.rand_name('bucket')