# 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
from deckhand import factories
from deckhand.tests.unit.control import base as test_base
            headers={'Content-Type': 'application/x-yaml'})
        self.assertEqual(201, resp.status_code)

        resp = self.app.simulate_delete(
            '/api/v1.0/revisions/%s/tags/%s' % (self.revision_id, 'test'),
            headers={'Content-Type': 'application/x-yaml'})
        self.assertEqual(204, resp.status_code)

        resp = self.app.simulate_get(
            '/api/v1.0/revisions/%s/tags/%s' % (self.revision_id, 'test'),
            headers={'Content-Type': 'application/x-yaml'})
        self.assertEqual(404, resp.status_code)

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

        # self.revision_id already created in setUp.
        alt_revision_id = self._create_revision()
        tag = 'same_tag'

        # Apply the same tag to both revisions.
        for revision_id in (self.revision_id, alt_revision_id):
            resp = self.app.simulate_post(
                '/api/v1.0/revisions/%s/tags/%s' % (revision_id, tag),
                headers={'Content-Type': 'application/x-yaml'})
            self.assertEqual(201, 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_revision_tags_controller.py
import yaml
from deckhand import factories
from deckhand.tests.unit.control import base as test_base

            headers={'Content-Type': 'application/x-yaml'})
        self.assertEqual(201, resp.status_code)

        resp = self.app.simulate_delete(
            '/api/v1.0/revisions/%s/tags/%s' % (self.revision_id, 'test'),
            headers={'Content-Type': 'application/x-yaml'})
        self.assertEqual(204, resp.status_code)

        resp = self.app.simulate_get(
            '/api/v1.0/revisions/%s/tags/%s' % (self.revision_id, 'test'),
            headers={'Content-Type': 'application/x-yaml'})
        self.assertEqual(404, resp.status_code)

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

        # self.revision_id already created in setUp.
        alt_revision_id = self._create_revision()
        tag = 'same_tag'

        # Apply the same tag to both revisions.
        for revision_id in (self.revision_id, alt_revision_id):
            resp = self.app.simulate_post(
                '/api/v1.0/revisions/%s/tags/%s' % (revision_id, tag),
                headers={'Content-Type': 'application/x-yaml'})
            self.assertEqual(201, resp.status_code)



class TestRevisionTagsControllerNegativeRBAC(test_base.BaseControllerTest):