mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
github tests: Add test_team_edited_error_handling.
This doesn't test much interesting yet, but it will soon.
This commit is contained in:
@@ -423,3 +423,33 @@ A temporary team so that I can get some webhook fixtures!
|
|||||||
|
|
||||||
for event in ignored_events:
|
for event in ignored_events:
|
||||||
self.verify_post_is_ignored(payload, event)
|
self.verify_post_is_ignored(payload, event)
|
||||||
|
|
||||||
|
def test_team_edited_error_handling(self) -> None:
|
||||||
|
event = "team"
|
||||||
|
payload = dict(
|
||||||
|
action="edited",
|
||||||
|
changes=dict(
|
||||||
|
bogus_key1={},
|
||||||
|
bogus_key2={},
|
||||||
|
),
|
||||||
|
team=dict(
|
||||||
|
name="My Team"
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
log_mock = patch("zerver.decorator.webhook_unexpected_events_logger.exception")
|
||||||
|
|
||||||
|
with log_mock as m:
|
||||||
|
msg = self.client_post(
|
||||||
|
self.url,
|
||||||
|
payload,
|
||||||
|
HTTP_X_GITHUB_EVENT=event,
|
||||||
|
content_type="application/json",
|
||||||
|
)
|
||||||
|
|
||||||
|
m.assert_called_once()
|
||||||
|
msg = m.call_args[0][0]
|
||||||
|
stack_info = m.call_args[1]["stack_info"]
|
||||||
|
|
||||||
|
self.assertIn("content_type: application/json", msg)
|
||||||
|
self.assertTrue(stack_info)
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ def get_team_body(helper: Helper) -> str:
|
|||||||
if "privacy" in changes:
|
if "privacy" in changes:
|
||||||
new_visibility = payload["team"]["privacy"]
|
new_visibility = payload["team"]["privacy"]
|
||||||
return f"Team visibility changed to `{new_visibility}`"
|
return f"Team visibility changed to `{new_visibility}`"
|
||||||
else: # nocoverage
|
else:
|
||||||
raise UnexpectedWebhookEventType("GitHub", f"Team Edited: {changes.keys()}")
|
raise UnexpectedWebhookEventType("GitHub", f"Team Edited: {changes.keys()}")
|
||||||
|
|
||||||
def get_release_body(helper: Helper) -> str:
|
def get_release_body(helper: Helper) -> str:
|
||||||
|
|||||||
Reference in New Issue
Block a user