webhooks/jira: Decode topics on our end.

The problem addressed in 006e47198c
resurfaces with topics when a user provides a custom topic in the
webhook URL.
This commit is contained in:
Eeshan Garg
2018-12-03 21:29:39 -03:30
committed by Tim Abbott
parent 7d0d4b5eec
commit 901100bebf
3 changed files with 14 additions and 4 deletions

View File

@@ -66,6 +66,14 @@ class JiraHookTests(WebhookTestCase):
self.assertEqual(msg.content, expected_message)
self.assertEqual(msg.topic_name(), expected_topic)
def test_created_with_topic_with_spaces_double_escaped(self) -> None:
self.url = self.build_webhook_url(topic=quote(quote('alerts test')))
expected_topic = "alerts test"
expected_message = """Leo Franchi **created** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) priority Major, assigned to **no one**:
> New bug with hook"""
self.send_and_test_stream_message('created_v1', expected_topic, expected_message)
def test_created_with_unicode(self) -> None:
expected_topic = u"BUG-15: New bug with à hook"
expected_message = u"""Leo Franchià **created** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) priority Major, assigned to **no one**:

View File

@@ -243,5 +243,5 @@ def api_jira_webhook(request: HttpRequest, user_profile: UserProfile,
check_send_webhook_message(request, user_profile,
subject, content,
unquote_stream=True)
unquote_url_parameters=True)
return json_success()