Exemple #1
0
 def test_fault_call(self):
     # Ensure proper EC2 response on faults.
     message = 'test message'
     ex = webob.exc.HTTPNotFound(explanation=message)
     fault = faults.Fault(ex)
     req = wsgi.Request.blank('/test')
     req.GET['AWSAccessKeyId'] = "test_user_id:test_project_id"
     self.mox.StubOutWithMock(faults, 'ec2_error_response')
     faults.ec2_error_response(mox.IgnoreArg(), 'HTTPNotFound',
                               message=message, status=ex.status_int)
     self.mox.ReplayAll()
     fault(req)
Exemple #2
0
 def __call__(self, req):
     try:
         return req.get_response(self.application)
     except Exception as ex:
         LOG.exception(_("FaultWrapper: %s"), unicode(ex))
         return faults.Fault(webob.exc.HTTPInternalServerError())
 def __call__(self, req):
     try:
         return req.get_response(self.application)
     except Exception:
         LOG.exception(_LE("FaultWrapper error"))
         return faults.Fault(webob.exc.HTTPInternalServerError())
Exemple #4
0
 def test_fault_exception_status_int(self):
     """Ensure the status_int is set correctly on faults"""
     fault = faults.Fault(webob.exc.HTTPNotFound(explanation='test'))
     self.assertEquals(fault.wrapped_exc.status_int, 404)
Exemple #5
0
 def test_fault_exception(self):
     """Ensure the status_int is set correctly on faults"""
     fault = faults.Fault(webob.exc.HTTPBadRequest(explanation='test'))
     self.assertTrue(isinstance(fault.wrapped_exc,
                                webob.exc.HTTPBadRequest))