Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

jira tests: Test ignored events.

Steve Howell56bfae3facfe
diff --git a/zerver/webhooks/jira/tests.py b/zerver/webhooks/jira/tests.py
index f0a68231f5e..8c04c96f2d4 100644
--- a/zerver/webhooks/jira/tests.py
+++ b/zerver/webhooks/jira/tests.py
@@ -1,3 +1,4 @@
+from unittest.mock import patch
from urllib.parse import quote, unquote
from zerver.lib.test_classes import WebhookTestCase
@@ -43,6 +44,28 @@ Leo Franchi created [BUG-15: New bug with hook](http://lfranchi.com:8080/browse/
self.check_webhook("created_v1", expected_topic, expected_message)
self.check_webhook("created_v2", expected_topic, expected_message)
+ def test_ignored_events(self) -> None:
+ ignored_actions = [
+ "attachment_created",
+ "issuelink_created",
+ "issuelink_deleted",
+ "sprint_closed",
+ "sprint_started",
+ "worklog_created",
+ "worklog_updated",
+ ]
+ for action in ignored_actions:
+ url = self.build_webhook_url()
+ payload = dict(webhookEvent=action)
+ with patch("zerver.webhooks.jira.view.check_send_webhook_message") as m:
+ result = self.client_post(
+ url,
+ payload,
+ content_type="application/json"
+ )
+ self.assertFalse(m.called)
+ self.assert_json_success(result)
+
def test_created_with_stream_with_spaces_escaped(self) -> None:
self.STREAM_NAME = quote('jira alerts')
self.url = self.build_webhook_url()