# Path: lepo/excs.py
# class ExceptionalResponse(Exception):
#     """
#     Wraps a Response in an exception.
# 
#     These exceptions are caught in PathView.
#     """
#     def __init__(self, response):
#         self.response = response
# 
# Path: lepo_tests/tests/utils.py
# TESTS_DIR = os.path.dirname(__file__)
# DOC_VERSIONS = ['swagger2', 'openapi3']
# def get_router(fixture_name):
# def get_data_from_response(response, status=200):
# def cast_parameter_value(apidoc, parameter, value):
# def get_apidoc_from_version(version, content={}):
# def make_request_for_operation(operation, method='GET', query_string=''):


from django.http.response import HttpResponse
from lepo.excs import ExceptionalResponse
from lepo_tests.tests.utils import doc_versions, get_router



def greet(request, greeting, greetee):
    raise ExceptionalResponse(HttpResponse('oh no', status=400))


@doc_versions
def test_exceptional_response(rf, doc_version):
    router = get_router(f'{doc_version}/parameter-test.yaml')
    router.add_handlers({'greet': greet})

# Path: lepo/excs.py
# class ExceptionalResponse(Exception):
#     """
#     Wraps a Response in an exception.
# 
#     These exceptions are caught in PathView.
#     """
#     def __init__(self, response):
#         self.response = response
# 
# Path: lepo_tests/tests/utils.py
# TESTS_DIR = os.path.dirname(__file__)
# DOC_VERSIONS = ['swagger2', 'openapi3']
# def get_router(fixture_name):
# def get_data_from_response(response, status=200):
# def cast_parameter_value(apidoc, parameter, value):
# def get_apidoc_from_version(version, content={}):
# def make_request_for_operation(operation, method='GET', query_string=''):


# Path: lepo_tests/tests/test_exceptional_response.py
from django.http.response import HttpResponse
from lepo.excs import ExceptionalResponse
from lepo_tests.tests.utils import doc_versions, get_router




def greet(request, greeting, greetee):
    raise ExceptionalResponse(HttpResponse('oh no', status=400))


@doc_versions
def test_exceptional_response(rf, doc_version):
    router = get_router(f'{doc_version}/parameter-test.yaml')
    router.add_handlers({'greet': greet})

    path_view = router.get_path_view_class('/greet').as_view()