Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
test_logging_handlers: Use delattr instead to unset request.user.
Zixuan James Libdee079b0de3
diff --git a/zerver/tests/test_logging_handlers.py b/zerver/tests/test_logging_handlers.pyindex 7ce95fcc74c..346d57a0435 100644--- a/zerver/tests/test_logging_handlers.py+++ b/zerver/tests/test_logging_handlers.py@@ -233,7 +233,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):self.assertEqual(report["stack_trace"], "No stack trace available")# Test arbitrary exceptions from request.user- record.request.user = None+ delattr(record.request, "user")with patch("zerver.logging_handlers.traceback.print_exc"):report = self.run_handler(record)self.assertIn("host", report)@@ -243,6 +243,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):self.assertIn("user_role", report["user"])self.assertIn("message", report)self.assertIn("stack_trace", report)+ self.assertEqual(report["user"]["user_email"], None)class LoggingConfigTest(ZulipTestCase):