Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_decorators: Replace webhook logger mock with assertLogs.
Dinesh2846d188549a
diff --git a/zerver/tests/test_decorators.py b/zerver/tests/test_decorators.pyindex ed8884fddc0..ace1fe66f63 100644--- a/zerver/tests/test_decorators.py+++ b/zerver/tests/test_decorators.py@@ -475,11 +475,11 @@ class DecoratorLoggingTestCase(ZulipTestCase):request.body = b"{}"request.content_type = "text/plain"- with mock.patch("zerver.decorator.webhook_logger.exception") as mock_exception:+ with self.assertLogs("zulip.zerver.webhooks") as logger:with self.assertRaisesRegex(Exception, "raised by webhook function"):my_webhook_raises_exception(request)- mock_exception.assert_called_with("raised by webhook function", stack_info=True)+ self.assertIn("raised by webhook function", logger.output[0])def test_authenticated_rest_api_view_logging_unsupported_event(self) -> None:@authenticated_rest_api_view(webhook_client_name="ClientName")