'Assert that an exception is being thrown from process_request.'

def _middleware_failure(self, exc, *args, **kwargs):

    class _Failing(self.MIDDLEWARE_CLASS, ):
        _called = False
        def fill_context(i_self, *i_args, **i_kwargs):
            e = self.assertRaises(exc, super(_Failing, i_self).fill_context, *i_args, **i_kwargs)
            i_self._called = True
            raise e
    kwargs.setdefault('status', http_client.INTERNAL_SERVER_ERROR)
    app = _Failing(self._application())
    resp = self._generate_app_response(app, *args, **kwargs)
    self.assertTrue(app._called)
    return resp
