# Path: deckhand/factories.py
# LOG = logging.getLogger(__name__)
# DOCUMENT_TEST_SCHEMA = 'example/Kind/v1'
#     DATA_SCHEMA_TEMPLATE = {
#         "data": {
#             "$schema": ""
#         },
#         "metadata": {
#             "schema": "metadata/Control/v1",
#             "name": "",
#             "labels": {},
#             "layeringDefinition": {
#                 "abstract": True,
#                 "layer": "site"
#             }
#         },
#         "schema": "deckhand/DataSchema/v1"
#     }
#     LAYERING_POLICY_TEMPLATE = {
#         "data": {
#             "layerOrder": []
#         },
#         "metadata": {
#             "name": "placeholder",
#             "schema": "metadata/Control/v1",
#             "layeringDefinition": {
#                 "abstract": False,
#                 "layer": "layer"
#             }
#         },
#         "schema": "deckhand/LayeringPolicy/v1"
#     }
#     DOCUMENT_TEMPLATE = {
#         "data": {},
#         "metadata": {
#             "labels": {"": ""},
#             "layeringDefinition": {
#                 "abstract": False,
#                 "layer": "layer"
#             },
#             "name": "",
#             "schema": "metadata/Document/v1"
#         },
#         "schema": DOCUMENT_TEST_SCHEMA
#     }
#     DOCUMENT_SECRET_TEMPLATE = {
#         "data": {
#         },
#         "metadata": {
#             "schema": "metadata/Document/v1",
#             "name": "",
#             "layeringDefinition": {
#                 "abstract": False,
#                 "layer": "site"
#             },
#             "storagePolicy": "",
#         },
#         "schema": "deckhand/%s/v1"
#     }
# class DeckhandFactory(object):
# class DataSchemaFactory(DeckhandFactory):
# class DocumentFactory(DeckhandFactory):
# class DocumentSecretFactory(DeckhandFactory):
#     def gen_test(self, *args, **kwargs):
#     def __init__(self):
#     def gen_test(self, metadata_name, data, **metadata_labels):
#     def __init__(self, num_layers, docs_per_layer):
#     def gen_test(self, mapping, site_abstract=True, region_abstract=True,
#                  global_abstract=True, site_parent_selectors=None):
#     def __init__(self):
#     def gen_test(self, schema, storage_policy, data=None, name=None):
# 
# Path: deckhand/tests/unit/control/base.py
# class BaseControllerTest(test_base.DeckhandWithDBTestCase,
#                          falcon_testing.TestCase):
#     def setUp(self):
#     def _read_data(self, file_name):


import yaml
import mock
from deckhand import factories
from deckhand.tests.unit.control import base as test_base
        self.assertEqual(200, resp.status_code)

    def test_request_with_no_content_type_on_get(self):
        resp = self.app.simulate_get(
            '/versions',
            headers={})
        self.assertEqual(200, resp.status_code)

    def test_request_with_superfluous_content_type_on_get(self):
        resp = self.app.simulate_get(
            '/versions',
            headers={'Content-Type': 'application/x-yaml'},
        )
        self.assertEqual(200, resp.status_code)

    def test_request_with_correct_content_type_plus_encoding(self):
        rules = {'deckhand:create_cleartext_documents': '@'}
        self.policy.set_rules(rules)

        documents_factory = factories.DocumentFactory(1, [1])
        document = documents_factory.gen_test({})[-1]

        resp = self.app.simulate_put(
            '/api/v1.0/buckets/b1/documents',
            headers={'Content-Type': 'application/x-yaml;encoding=utf-8'},
            body=yaml.safe_dump(document),
        )
        self.assertEqual(200, resp.status_code)



# Path: deckhand/factories.py
# LOG = logging.getLogger(__name__)
# DOCUMENT_TEST_SCHEMA = 'example/Kind/v1'
#     DATA_SCHEMA_TEMPLATE = {
#         "data": {
#             "$schema": ""
#         },
#         "metadata": {
#             "schema": "metadata/Control/v1",
#             "name": "",
#             "labels": {},
#             "layeringDefinition": {
#                 "abstract": True,
#                 "layer": "site"
#             }
#         },
#         "schema": "deckhand/DataSchema/v1"
#     }
#     LAYERING_POLICY_TEMPLATE = {
#         "data": {
#             "layerOrder": []
#         },
#         "metadata": {
#             "name": "placeholder",
#             "schema": "metadata/Control/v1",
#             "layeringDefinition": {
#                 "abstract": False,
#                 "layer": "layer"
#             }
#         },
#         "schema": "deckhand/LayeringPolicy/v1"
#     }
#     DOCUMENT_TEMPLATE = {
#         "data": {},
#         "metadata": {
#             "labels": {"": ""},
#             "layeringDefinition": {
#                 "abstract": False,
#                 "layer": "layer"
#             },
#             "name": "",
#             "schema": "metadata/Document/v1"
#         },
#         "schema": DOCUMENT_TEST_SCHEMA
#     }
#     DOCUMENT_SECRET_TEMPLATE = {
#         "data": {
#         },
#         "metadata": {
#             "schema": "metadata/Document/v1",
#             "name": "",
#             "layeringDefinition": {
#                 "abstract": False,
#                 "layer": "site"
#             },
#             "storagePolicy": "",
#         },
#         "schema": "deckhand/%s/v1"
#     }
# class DeckhandFactory(object):
# class DataSchemaFactory(DeckhandFactory):
# class DocumentFactory(DeckhandFactory):
# class DocumentSecretFactory(DeckhandFactory):
#     def gen_test(self, *args, **kwargs):
#     def __init__(self):
#     def gen_test(self, metadata_name, data, **metadata_labels):
#     def __init__(self, num_layers, docs_per_layer):
#     def gen_test(self, mapping, site_abstract=True, region_abstract=True,
#                  global_abstract=True, site_parent_selectors=None):
#     def __init__(self):
#     def gen_test(self, schema, storage_policy, data=None, name=None):
# 
# Path: deckhand/tests/unit/control/base.py
# class BaseControllerTest(test_base.DeckhandWithDBTestCase,
#                          falcon_testing.TestCase):
#     def setUp(self):
#     def _read_data(self, file_name):


# Path: deckhand/tests/unit/control/test_middleware.py
import yaml
import mock
from deckhand import factories
from deckhand.tests.unit.control import base as test_base

        self.assertEqual(200, resp.status_code)

    def test_request_with_no_content_type_on_get(self):
        resp = self.app.simulate_get(
            '/versions',
            headers={})
        self.assertEqual(200, resp.status_code)

    def test_request_with_superfluous_content_type_on_get(self):
        resp = self.app.simulate_get(
            '/versions',
            headers={'Content-Type': 'application/x-yaml'},
        )
        self.assertEqual(200, resp.status_code)

    def test_request_with_correct_content_type_plus_encoding(self):
        rules = {'deckhand:create_cleartext_documents': '@'}
        self.policy.set_rules(rules)

        documents_factory = factories.DocumentFactory(1, [1])
        document = documents_factory.gen_test({})[-1]

        resp = self.app.simulate_put(
            '/api/v1.0/buckets/b1/documents',
            headers={'Content-Type': 'application/x-yaml;encoding=utf-8'},
            body=yaml.safe_dump(document),
        )
        self.assertEqual(200, resp.status_code)



class TestYAMLTranslatorNegative(test_base.BaseControllerTest):