# Path: deckhand/policy.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# _ENFORCER = None
#         _ENFORCER = None
#         _ENFORCER = policy.Enforcer(CONF,
#                                     policy_file=policy_file,
#                                     rules=rules,
#                                     default_rule=default_rule,
#                                     use_conf=use_conf)
# def reset():
# def init(policy_file=None, rules=None, default_rule=None, use_conf=True):
# def _do_enforce_rbac(action, context, do_raise=True):
# def authorize(action):
#     def decorator(func):
#         def handler(*args, **kwargs):
# def conditional_authorize(action, context, do_raise=True):
# def register_rules(enforcer):
# 
# 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 os
import yaml
import falcon
import mock
from deckhand import policy
from deckhand.tests.unit.control import base as test_base
            resp = self.app.simulate_put(
                '/api/v1.0/buckets/test/documents',
                headers={'Content-Type': 'application/x-yaml'}, body=None)

        expected = {
            'status': 'Failure',
            'kind': 'Status',
            'code': '403 Forbidden',
            'apiVersion': 'v1.0',
            'reason': 'Unspecified',
            'retry': False,
            'details': {
                'errorType': 'HTTPForbidden',
                'errorCount': 1,
                'messageList': [
                    {
                        'message': expected_msg,
                        'error': True
                    }
                ]
            },
            'message': expected_msg,
            'metadata': {}
        }
        body = yaml.safe_load(resp.text)

        self.assertEqual(403, resp.status_code)
        self.assertEqual(expected, body)



# Path: deckhand/policy.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# _ENFORCER = None
#         _ENFORCER = None
#         _ENFORCER = policy.Enforcer(CONF,
#                                     policy_file=policy_file,
#                                     rules=rules,
#                                     default_rule=default_rule,
#                                     use_conf=use_conf)
# def reset():
# def init(policy_file=None, rules=None, default_rule=None, use_conf=True):
# def _do_enforce_rbac(action, context, do_raise=True):
# def authorize(action):
#     def decorator(func):
#         def handler(*args, **kwargs):
# def conditional_authorize(action, context, do_raise=True):
# def register_rules(enforcer):
# 
# 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_errors.py
import os
import yaml
import falcon
import mock
from deckhand import policy
from deckhand.tests.unit.control import base as test_base

            resp = self.app.simulate_put(
                '/api/v1.0/buckets/test/documents',
                headers={'Content-Type': 'application/x-yaml'}, body=None)

        expected = {
            'status': 'Failure',
            'kind': 'Status',
            'code': '403 Forbidden',
            'apiVersion': 'v1.0',
            'reason': 'Unspecified',
            'retry': False,
            'details': {
                'errorType': 'HTTPForbidden',
                'errorCount': 1,
                'messageList': [
                    {
                        'message': expected_msg,
                        'error': True
                    }
                ]
            },
            'message': expected_msg,
            'metadata': {}
        }
        body = yaml.safe_load(resp.text)

        self.assertEqual(403, resp.status_code)
        self.assertEqual(expected, body)



class TestValidationMessageFormatting(test_base.BaseControllerTest):