コード例 #1
0
  def testErrorHandlerCanProcessInternalServerError(self):
    """Test error handler can process HTTP error."""
    error_500 = exceptions.InternalServerError()
    resp = error_handler.handle_error(error_500)
    resp_obj = json.loads(resp.data[len(ufo.XSSI_PREFIX):])

    self.assertEqual(error_500.code, resp_obj['code'])
    self.assertEqual(error_500.description, resp_obj['message'])
コード例 #2
0
    def testErrorHandlerCanProcessInternalServerError(self):
        """Test error handler can process HTTP error."""
        error_500 = exceptions.InternalServerError()
        resp = error_handler.handle_error(error_500)
        resp_obj = json.loads(resp.data[len(ufo.XSSI_PREFIX):])

        self.assertEqual(error_500.code, resp_obj['code'])
        self.assertEqual(error_500.description, resp_obj['message'])
コード例 #3
0
    def ErrorHandlerCanProcessCustomError(self):
        """Test error handler can process custom error."""
        setup_needed_error = SetupNeeded()
        werkzeug_error = exceptions.InternalServerError(SetupNeeded.message)

        resp = error_handler.handle_error(setup_needed_error)

        self.assertEqual(werkzeug_error.code, resp[1])
        self.assertTrue(str(werkzeug_error.code) in resp[0].data)
        self.assertTrue(werkzeug_error.message in resp[0].data)
コード例 #4
0
  def ErrorHandlerCanProcessCustomError(self):
    """Test error handler can process custom error."""
    setup_needed_error = SetupNeeded()
    werkzeug_error = exceptions.InternalServerError(
        SetupNeeded.message)

    resp = error_handler.handle_error(setup_needed_error)

    self.assertEqual(werkzeug_error.code, resp[1])
    self.assertTrue(str(werkzeug_error.code) in resp[0].data)
    self.assertTrue(werkzeug_error.message in resp[0].data)