bito-code-review[bot] commented on code in PR #44666:
URL: https://github.com/apache/superset/pull/44666#discussion_r4113909872
##########
tests/unit_tests/views/test_error_handling.py:
##########
@@ -293,6 +303,179 @@ def
test_html_accept_serves_branded_error_page_not_raw_json(self):
mock_send_file.assert_called_once()
+class TestShowHttpException:
+ """
+ Client-side HTTP errors are not server faults and must not log tracebacks.
+ """
+
+ def _build_app_with_handlers(self, error: HTTPException) -> Flask:
+ test_app = Flask(__name__)
+ test_app.config["DEBUG"] = False
+ Babel(test_app)
+ set_app_error_handlers(test_app)
+
+ @test_app.route("/http-error")
+ def http_error_view() -> FlaskResponse:
+ raise error
+
+ return test_app
+
+ @staticmethod
+ def _handler_records(
+ caplog: pytest.LogCaptureFixture,
+ ) -> list[logging.LogRecord]:
+ return [
+ record
+ for record in caplog.records
+ if record.name == "superset.views.error_handling"
+ ]
+
+ def test_routing_404_logs_no_warning_and_no_traceback(
Review Comment:
<!-- Bito Reply -->
The suggestion to add docstrings to the test methods is appropriate and
aligns with the project's documentation standards. Applying this suggestion
improves code maintainability and clarity by explicitly stating the scenario
and expected behavior for each test case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]