# Path: shelf/endpoint_decorators.py
# class EndpointDecorators(object):
#     REDACTED_HEADERS = {
#         "authorization": 50
#     }
#     def merge(self, func, *decorator_list):
#     def foundation(self, func):
#     def foundation_headers(self, func):
#     def logtraffic(self, func):
#     def logbodies(self, func):
#         def wrapper(container, *args, **kwargs):
#             def log(message, data):
#     def logheaders(self, func):
#         def wrapper(container, *args, **kwargs):
#             def redact_headers(headers):
#     def injectcontainer(self, func):
#         def wrapper(*args, **kwargs):
#     def validate_storage_accessible(self, func):
#         def wrapper(container, *args, **kwargs):
#     def auth(self, func):
#         def wrapper(container, *args, **kwargs):
#     def decode_request(self, container, default_request_body=None):
#     def validate_request(self, schema_path, default_request_body=None):
#         def validation_decorator(func):
#             def wrapper(container, *args, **kwargs):


import pyproctor
from shelf.endpoint_decorators import decorators
from mock import Mock, call
                    "host: yes\n"
                    "auThOrIzAtion: REDACTED\n"
                    "Authorization: REDACTED\n"
                    "authorization: REDACTED\n"
                    "SafeStuff: This better be logged this way"
                ),
                call("RESPONSE HEADERS : \nSTATUS CODE: 200\ncontent-type: application/json")
            ]
        )

    def test_logbodies_errors_on_invalid_json(self):
        """
            Tests the logbodies function to make sure it correctly
            catches invalid JSON requests.
        """
        data = "{\"invalid\": ...}"
        valueErrorStr = "No JSON object could be decoded"
        logger_mock = Mock()
        request_mock = type("FakeRequest", (), {
            "headers": {
                "content-type": "application/json"
            },
            "data": data
        })
        request_mock.get_data = Mock(return_value=data)
        mock_container = type("FakeContainer", (), {
            "logger": logger_mock,
            "request": request_mock
        })


# Path: shelf/endpoint_decorators.py
# class EndpointDecorators(object):
#     REDACTED_HEADERS = {
#         "authorization": 50
#     }
#     def merge(self, func, *decorator_list):
#     def foundation(self, func):
#     def foundation_headers(self, func):
#     def logtraffic(self, func):
#     def logbodies(self, func):
#         def wrapper(container, *args, **kwargs):
#             def log(message, data):
#     def logheaders(self, func):
#         def wrapper(container, *args, **kwargs):
#             def redact_headers(headers):
#     def injectcontainer(self, func):
#         def wrapper(*args, **kwargs):
#     def validate_storage_accessible(self, func):
#         def wrapper(container, *args, **kwargs):
#     def auth(self, func):
#         def wrapper(container, *args, **kwargs):
#     def decode_request(self, container, default_request_body=None):
#     def validate_request(self, schema_path, default_request_body=None):
#         def validation_decorator(func):
#             def wrapper(container, *args, **kwargs):


# Path: tests/endpoint_decorators_test.py
import pyproctor
from shelf.endpoint_decorators import decorators
from mock import Mock, call

                    "host: yes\n"
                    "auThOrIzAtion: REDACTED\n"
                    "Authorization: REDACTED\n"
                    "authorization: REDACTED\n"
                    "SafeStuff: This better be logged this way"
                ),
                call("RESPONSE HEADERS : \nSTATUS CODE: 200\ncontent-type: application/json")
            ]
        )

    def test_logbodies_errors_on_invalid_json(self):
        """
            Tests the logbodies function to make sure it correctly
            catches invalid JSON requests.
        """
        data = "{\"invalid\": ...}"
        valueErrorStr = "No JSON object could be decoded"
        logger_mock = Mock()
        request_mock = type("FakeRequest", (), {
            "headers": {
                "content-type": "application/json"
            },
            "data": data
        })
        request_mock.get_data = Mock(return_value=data)
        mock_container = type("FakeContainer", (), {
            "logger": logger_mock,
            "request": request_mock
        })


        @decorators.logbodies