mirror of https://github.com/zulip/zulip.git
typing: Add assertions for report returned from notify_server_error.
We don't have a specific type for the reports returned from the error logging handlers. The check is necessary as they are currently typed as `Dict[str, object]` in `run_handler`. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
8ba8177dc5
commit
428dfd2693
|
@ -125,6 +125,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
|
|
||||||
report = self.run_handler(record)
|
report = self.run_handler(record)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
@ -141,6 +142,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
|
|
||||||
report = self.run_handler(record)
|
report = self.run_handler(record)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
@ -162,6 +164,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
report = self.run_handler(record)
|
report = self.run_handler(record)
|
||||||
self.assertIn("host", report)
|
self.assertIn("host", report)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
@ -180,6 +183,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
record.request.get_host = orig_get_host
|
record.request.get_host = orig_get_host
|
||||||
self.assertIn("host", report)
|
self.assertIn("host", report)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
@ -192,6 +196,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
record.request.method = "GET"
|
record.request.method = "GET"
|
||||||
self.assertIn("host", report)
|
self.assertIn("host", report)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
@ -222,6 +227,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
report = self.run_handler(record)
|
report = self.run_handler(record)
|
||||||
self.assertIn("host", report)
|
self.assertIn("host", report)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
@ -233,6 +239,7 @@ class AdminNotifyHandlerTest(ZulipTestCase):
|
||||||
report = self.run_handler(record)
|
report = self.run_handler(record)
|
||||||
self.assertIn("host", report)
|
self.assertIn("host", report)
|
||||||
self.assertIn("user", report)
|
self.assertIn("user", report)
|
||||||
|
assert isinstance(report["user"], dict)
|
||||||
self.assertIn("user_email", report["user"])
|
self.assertIn("user_email", report["user"])
|
||||||
self.assertIn("user_role", report["user"])
|
self.assertIn("user_role", report["user"])
|
||||||
self.assertIn("message", report)
|
self.assertIn("message", report)
|
||||||
|
|
Loading…
Reference in New Issue