'Test that error in response middleware is propagated up'

def test_response_middleware_raises_exception(self):

    class RaiseErrorMiddleware(object, ):
        def process_response(self, req, resp, resource):
            raise Exception('Always    fail')
    app = falcon.API(middleware=[RaiseErrorMiddleware()])
    app.add_route(TEST_ROUTE, MiddlewareClassResource())
    client = testing.TestClient(app)
    with pytest.raises(Exception):
        client.simulate_request(path=TEST_ROUTE)
