messages: Strip trailing whitespace in message contents.

I dug into why we never did this before, and it turns out we did, but
using `$.trim()` (which removes leading whitespace as well!).  When
removing the `$.trim()` usage.

Fixes #3294.
This commit is contained in:
Tim Abbott 2017-02-11 19:22:13 -08:00
parent 6ee845d027
commit 4060a97656
10 changed files with 84 additions and 81 deletions

View File

@ -47,7 +47,7 @@ casper.then(function () {
casper.then(function () {
common.expected_messages('zhome', ['Verona > Test mention all'],
["<p><span class=\"user-mention user-mention-me\" data-user-id=\"*\">@all</span> </p>"]);
["<p><span class=\"user-mention user-mention-me\" data-user-id=\"*\">@all</span></p>"]);
});

View File

@ -1235,7 +1235,7 @@ def send_pm_if_empty_stream(sender, stream, stream_name, realm):
# check_message:
# Returns message ready for sending with do_send_message on success or the error message (string) on error.
def check_message(sender, client, message_type_name, message_to,
subject_name, message_content, realm=None, forged=False,
subject_name, message_content_raw, realm=None, forged=False,
forged_timestamp=None, forwarder_user_profile=None, local_id=None,
sender_queue_id=None):
# type: (UserProfile, Client, Text, Sequence[Text], Text, Text, Optional[Realm], bool, Optional[float], Optional[UserProfile], Optional[Text], Optional[Text]) -> Dict[str, Any]
@ -1243,9 +1243,10 @@ def check_message(sender, client, message_type_name, message_to,
if not message_to and message_type_name == 'stream' and sender.default_sending_stream:
# Use the users default stream
message_to = [sender.default_sending_stream.name]
elif len(message_to) == 0:
if len(message_to) == 0:
raise JsonableError(_("Message must have recipients"))
if len(message_content.strip()) == 0:
message_content = message_content_raw.strip()
if len(message_content) == 0:
raise JsonableError(_("Message must not be empty"))
message_content = truncate_body(message_content)

View File

@ -853,6 +853,20 @@ class MessagePOSTTest(ZulipTestCase):
self.assertEqual(ujson.loads(result1.content)['id'],
ujson.loads(result2.content)['id'])
def test_strip_message(self):
# type: () -> None
"""
Sending a message longer than the maximum message length succeeds but is
truncated.
"""
self.login("hamlet@zulip.com")
post_data = {"type": "stream", "to": "Verona", "client": "test suite",
"content": "I like whitespace at the end! \n\n \n", "subject": "Test subject"}
result = self.client_post("/json/messages", post_data)
self.assert_json_success(result)
sent_message = self.get_last_message()
self.assertEqual(sent_message.content, "I like whitespace at the end!")
def test_long_message(self):
# type: () -> None
"""

View File

@ -21,7 +21,7 @@ class DeskDotComHookTests(WebhookTestCase):
# type: () -> None
expected_subject = u"static text notification"
expected_message = u"This is a custom action.\n"
expected_message = u"This is a custom action."
self.send_and_test_stream_message('static_text', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded",
@ -32,7 +32,7 @@ class DeskDotComHookTests(WebhookTestCase):
expected_subject = u"case updated notification"
expected_message = (u"Case 2 updated. "
u"Link: <a href='https://deskdotcomtest.desk.com/web/agent/case/2'>"
u"I have a question</a>\n")
u"I have a question</a>")
self.send_and_test_stream_message('case_updated', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded",
@ -44,7 +44,7 @@ class DeskDotComHookTests(WebhookTestCase):
expected_subject = u"case updated notification"
expected_message = (u"Case 2 updated. "
u"Link: <a href='https://deskdotcomtest.desk.com/web/agent/case/2'>"
u"Il mio hovercraft è pieno di anguille.</a>\n")
u"Il mio hovercraft è pieno di anguille.</a>")
self.send_and_test_stream_message('unicode_text_italian', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded",
@ -56,7 +56,7 @@ class DeskDotComHookTests(WebhookTestCase):
expected_subject = u"case updated notification"
expected_message = (u"Case 2 updated. "
u"Link: <a href='https://deskdotcomtest.desk.com/web/agent/case/2'>"
u"私のホバークラフトは鰻でいっぱいです</a>\n")
u"私のホバークラフトは鰻でいっぱいです</a>")
self.send_and_test_stream_message('unicode_text_japanese', expected_subject, expected_message,
content_type="application/x-www-form-urlencoded",

View File

@ -14,7 +14,7 @@ class GreenhouseHookTests(WebhookTestCase):
expected_message = ("Hire Candidate\n>Johnny Smith\nID: 19"
"\nApplying for role:\nDeveloper\n**Emails:**"
"\nPersonal\npersonal@example.com\nWork\nwork@example.com\n\n\n>"
"**Attachments:**\n[Resume](https://prod-heroku.s3.amazonaws.com/...)\n")
"**Attachments:**\n[Resume](https://prod-heroku.s3.amazonaws.com/...)")
self.send_and_test_stream_message('candidate_hired',
expected_subject,
@ -28,7 +28,7 @@ class GreenhouseHookTests(WebhookTestCase):
"265788\nApplying for role:\nDesigner"
"\n**Emails:**\nPersonal\n"
"hector.porter.265788@example.com\n\n\n>"
"**Attachments:**\n[Resume](https://prod-heroku.s3.amazonaws.com/...)\n")
"**Attachments:**\n[Resume](https://prod-heroku.s3.amazonaws.com/...)")
self.send_and_test_stream_message('candidate_rejected',
expected_subject,
@ -44,7 +44,7 @@ class GreenhouseHookTests(WebhookTestCase):
"\ngiuseppe.hurley@example.com\n\n\n>"
"**Attachments:**\n[Resume](https://prod-heroku.s3.amazonaws.com/...)"
"\n[Cover_Letter](https://prod-heroku.s3.amazonaws.com/...)"
"\n[Attachment](https://prod-heroku.s3.amazonaws.com/...)\n")
"\n[Attachment](https://prod-heroku.s3.amazonaws.com/...)")
self.send_and_test_stream_message('candidate_stage_change',
expected_subject,
@ -58,7 +58,7 @@ class GreenhouseHookTests(WebhookTestCase):
"\nID: 968190\nApplying for role:\n"
"Designer\n**Emails:**\nPersonal"
"\nt.troy@example.com\n\n\n>**Attachments:**"
"\n[Resume](https://prod-heroku.s3.amazonaws.com/...)\n")
"\n[Resume](https://prod-heroku.s3.amazonaws.com/...)")
self.send_and_test_stream_message('prospect_created',
expected_subject,

View File

@ -62,8 +62,7 @@ class JiraHookTests(WebhookTestCase):
expected_message = """Leo Franchi **added comment to** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) (assigned to **Othello, the Moor of Venice**):
Adding a comment. Oh, what a comment it is!
"""
Adding a comment. Oh, what a comment it is!"""
self.send_and_test_stream_message('commented_v1', expected_subject, expected_message)
self.send_and_test_stream_message('commented_v2', expected_subject, expected_message)
@ -73,8 +72,7 @@ Adding a comment. Oh, what a comment it is!
expected_message = """Leo Franchi **edited comment on** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) (assigned to **Othello, the Moor of Venice**):
Adding a comment. Oh, what a comment it is!
"""
Adding a comment. Oh, what a comment it is!"""
self.send_and_test_stream_message('comment_edited_v2', expected_subject, expected_message)
def test_comment_deleted(self):
@ -86,7 +84,7 @@ Adding a comment. Oh, what a comment it is!
def test_commented_markup(self):
# type: () -> None
expected_subject = "TEST-7: Testing of rich text"
expected_message = """Leonardo Franchi [Administrator] **added comment to** [TEST-7](https://zulipp.atlassian.net/browse/TEST-7):\n\n\nThis is a comment that likes to **exercise** a lot of _different_ `conventions` that `jira uses`.\r\n\r\n~~~\n\r\nthis code is not highlighted, but monospaced\r\n\n~~~\r\n\r\n~~~\n\r\ndef python():\r\n print "likes to be formatted"\r\n\n~~~\r\n\r\n[http://www.google.com](http://www.google.com) is a bare link, and [Google](http://www.google.com) is given a title.\r\n\r\nThanks!\r\n\r\n~~~ quote\n\r\nSomeone said somewhere\r\n\n~~~\n"""
expected_message = """Leonardo Franchi [Administrator] **added comment to** [TEST-7](https://zulipp.atlassian.net/browse/TEST-7):\n\n\nThis is a comment that likes to **exercise** a lot of _different_ `conventions` that `jira uses`.\r\n\r\n~~~\n\r\nthis code is not highlighted, but monospaced\r\n\n~~~\r\n\r\n~~~\n\r\ndef python():\r\n print "likes to be formatted"\r\n\n~~~\r\n\r\n[http://www.google.com](http://www.google.com) is a bare link, and [Google](http://www.google.com) is given a title.\r\n\r\nThanks!\r\n\r\n~~~ quote\n\r\nSomeone said somewhere\r\n\n~~~"""
self.send_and_test_stream_message('commented_markup_v1', expected_subject, expected_message)
self.send_and_test_stream_message('commented_markup_v2', expected_subject, expected_message)
@ -102,8 +100,7 @@ Adding a comment. Oh, what a comment it is!
expected_subject = "BUG-15: New bug with hook"
expected_message = """Leo Franchi **updated** [BUG-15](http://lfranchi.com:8080/browse/BUG-15) (assigned to **Othello, the Moor of Venice**):
* Changed assignee to **Othello, the Moor of Venice**
"""
* Changed assignee to **Othello, the Moor of Venice**"""
self.send_and_test_stream_message('reassigned_v1', expected_subject, expected_message)
self.send_and_test_stream_message('reassigned_v2', expected_subject, expected_message)
@ -112,8 +109,7 @@ Adding a comment. Oh, what a comment it is!
expected_subject = "TEST-1: Fix That"
expected_message = """Leonardo Franchi [Administrator] **updated** [TEST-1](https://zulipp.atlassian.net/browse/TEST-1) (assigned to **leo@zulip.com**):
* Changed priority from **Critical** to **Major**
"""
* Changed priority from **Critical** to **Major**"""
self.send_and_test_stream_message('updated_priority_v1', expected_subject, expected_message)
self.send_and_test_stream_message('updated_priority_v2', expected_subject, expected_message)
@ -122,8 +118,7 @@ Adding a comment. Oh, what a comment it is!
expected_subject = "TEST-1: Fix That"
expected_message = """Leonardo Franchi [Administrator] **updated** [TEST-1](https://zulipp.atlassian.net/browse/TEST-1):
* Changed status from **To Do** to **In Progress**
"""
* Changed status from **To Do** to **In Progress**"""
self.send_and_test_stream_message('change_status_v1', expected_subject, expected_message)
self.send_and_test_stream_message('change_status_v2', expected_subject, expected_message)

View File

@ -90,8 +90,7 @@ class PivotalV5HookTests(WebhookTestCase):
# type: () -> None
expected_subject = '#63486316: Story of the Year'
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Story of the Year](http://www.pivotaltracker.com/story/show/63486316):
* state changed from **unstarted** to **accepted**
"""
* state changed from **unstarted** to **accepted**"""
self.send_and_test_stream_message('accepted', expected_subject, expected_message, content_type="application/xml")
def test_commented(self):
@ -117,16 +116,14 @@ A comment on the story
# type: () -> None
expected_subject = '#63486316: Story of the Year'
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Story of the Year](http://www.pivotaltracker.com/story/show/63486316):
* state changed from **accepted** to **delivered**
"""
* state changed from **accepted** to **delivered**"""
self.send_and_test_stream_message('delivered', expected_subject, expected_message, content_type="application/xml")
def test_finished(self):
# type: () -> None
expected_subject = '#63486316: Story of the Year'
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Story of the Year](http://www.pivotaltracker.com/story/show/63486316):
* state changed from **delivered** to **accepted**
"""
* state changed from **delivered** to **accepted**"""
self.send_and_test_stream_message('finished', expected_subject, expected_message, content_type="application/xml")
def test_moved(self):
@ -143,24 +140,21 @@ A comment on the story
~~~quote
Try again next time
~~~
* state changed from **delivered** to **rejected**
"""
* state changed from **delivered** to **rejected**"""
self.send_and_test_stream_message('rejected', expected_subject, expected_message, content_type="application/xml")
def test_started(self):
# type: () -> None
expected_subject = '#63495972: Fresh Story'
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Fresh Story](http://www.pivotaltracker.com/story/show/63495972):
* state changed from **unstarted** to **started**
"""
* state changed from **unstarted** to **started**"""
self.send_and_test_stream_message('started', expected_subject, expected_message, content_type="application/xml")
def test_created_estimate(self):
# type: () -> None
expected_subject = '#63496066: Pivotal Test'
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Pivotal Test](http://www.pivotaltracker.com/story/show/63496066):
* estimate is now **3 points**
"""
* estimate is now **3 points**"""
self.send_and_test_stream_message('created_estimate', expected_subject, expected_message, content_type="application/xml")
def test_type_changed(self):
@ -168,8 +162,7 @@ Try again next time
expected_subject = '#63496066: Pivotal Test'
expected_message = """Leo Franchi updated [Hard Code](https://www.pivotaltracker.com/s/projects/807213): [Pivotal Test](http://www.pivotaltracker.com/story/show/63496066):
* estimate changed from 3 to **0 points**
* type changed from **feature** to **bug**
"""
* type changed from **feature** to **bug**"""
self.send_and_test_stream_message('type_changed', expected_subject, expected_message, content_type="application/xml")
def get_body(self, fixture_name):

View File

@ -15,210 +15,210 @@ class TaigaHookTests(WebhookTestCase):
def test_taiga_userstory_deleted(self):
# type: () -> None
message = u':x: TomaszKolek deleted user story **New userstory**.\n'
message = u':x: TomaszKolek deleted user story **New userstory**.'
self.send_and_test_stream_message("userstory_deleted", u'subject', message)
def test_taiga_userstory_created(self):
# type: () -> None
message = u':package: TomaszKolek created user story **New userstory**.\n'
message = u':package: TomaszKolek created user story **New userstory**.'
self.send_and_test_stream_message("userstory_created", u'subject', message)
def test_taiga_userstory_changed_unblocked(self):
# type: () -> None
message = u':unlock: TomaszKolek unblocked user story **UserStory**.\n'
message = u':unlock: TomaszKolek unblocked user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_unblocked", u'subject', message)
def test_taiga_userstory_changed_subject(self):
# type: () -> None
message = u':notebook: TomaszKolek renamed user story from UserStory to **UserStoryNewSubject**.\n'
message = u':notebook: TomaszKolek renamed user story from UserStory to **UserStoryNewSubject**.'
self.send_and_test_stream_message("userstory_changed_subject", u'subject', message)
def test_taiga_userstory_changed_status(self):
# type: () -> None
message = u':chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from Ready to In progress.\n'
message = u':chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from Ready to In progress.'
self.send_and_test_stream_message("userstory_changed_status", u'subject', message)
def test_taiga_userstory_changed_reassigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek reassigned user story **UserStory** from TomaszKolek to HanSolo.\n'
message = u':busts_in_silhouette: TomaszKolek reassigned user story **UserStory** from TomaszKolek to HanSolo.'
self.send_and_test_stream_message("userstory_changed_reassigned", u'subject', message)
def test_taiga_userstory_changed_unassigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek unassigned user story **UserStory**.\n'
message = u':busts_in_silhouette: TomaszKolek unassigned user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_unassigned", u'subject', message)
def test_taiga_userstory_changed_points(self):
# type: () -> None
message = u':game_die: TomaszKolek changed estimation of user story **UserStory**.\n'
message = u':game_die: TomaszKolek changed estimation of user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_points", u'subject', message)
def test_taiga_userstory_changed_new_sprint(self):
# type: () -> None
message = u':calendar: TomaszKolek added user story **UserStory** to sprint Sprint1.\n'
message = u':calendar: TomaszKolek added user story **UserStory** to sprint Sprint1.'
self.send_and_test_stream_message("userstory_changed_new_sprint", u'subject', message)
def test_taiga_userstory_changed_sprint(self):
# type: () -> None
message = u':calendar: TomaszKolek changed sprint of user story **UserStory** from Sprint1 to Sprint2.\n'
message = u':calendar: TomaszKolek changed sprint of user story **UserStory** from Sprint1 to Sprint2.'
self.send_and_test_stream_message("userstory_changed_sprint", u'subject', message)
def test_taiga_userstory_changed_remove_sprint(self):
# type: () -> None
message = u':calendar: TomaszKolek removed user story **UserStory** from sprint Sprint2.\n'
message = u':calendar: TomaszKolek removed user story **UserStory** from sprint Sprint2.'
self.send_and_test_stream_message("userstory_changed_remove_sprint", u'subject', message)
def test_taiga_userstory_changed_description(self):
# type: () -> None
message = u':notebook: TomaszKolek updated description of user story **UserStory**.\n'
message = u':notebook: TomaszKolek updated description of user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_description", u'subject', message)
def test_taiga_userstory_changed_closed(self):
# type: () -> None
message = u':chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from New to Done.\n:checkered_flag: TomaszKolek closed user story **UserStory**.\n'
message = u':chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from New to Done.\n:checkered_flag: TomaszKolek closed user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_closed", u'subject', message)
def test_taiga_userstory_changed_reopened(self):
# type: () -> None
message = u':chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from Done to Ready.\n:package: TomaszKolek reopened user story **UserStory**.\n'
message = u':chart_with_upwards_trend: TomaszKolek changed status of user story **UserStory** from Done to Ready.\n:package: TomaszKolek reopened user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_reopened", u'subject', message)
def test_taiga_userstory_changed_blocked(self):
# type: () -> None
message = u':lock: TomaszKolek blocked user story **UserStory**.\n'
message = u':lock: TomaszKolek blocked user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_blocked", u'subject', message)
def test_taiga_userstory_changed_assigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek assigned user story **UserStory** to TomaszKolek.\n'
message = u':busts_in_silhouette: TomaszKolek assigned user story **UserStory** to TomaszKolek.'
self.send_and_test_stream_message("userstory_changed_assigned", u'subject', message)
def test_taiga_userstory_comment_added(self):
# type: () -> None
message = u':thought_balloon: TomaszKolek commented on user story **UserStory**.\n'
message = u':thought_balloon: TomaszKolek commented on user story **UserStory**.'
self.send_and_test_stream_message("userstory_changed_comment_added", u'subject', message)
def test_taiga_task_created(self):
# type: () -> None
message = u':clipboard: TomaszKolek created task **New Task**.\n'
message = u':clipboard: TomaszKolek created task **New Task**.'
self.send_and_test_stream_message("task_created", u'subject', message)
def test_taiga_task_changed_status(self):
# type: () -> None
message = u':chart_with_upwards_trend: TomaszKolek changed status of task **New Task** from New to In progress.\n'
message = u':chart_with_upwards_trend: TomaszKolek changed status of task **New Task** from New to In progress.'
self.send_and_test_stream_message("task_changed_status", u'subject', message)
def test_taiga_task_changed_blocked(self):
# type: () -> None
message = u':lock: TomaszKolek blocked task **New Task**.\n'
message = u':lock: TomaszKolek blocked task **New Task**.'
self.send_and_test_stream_message("task_changed_blocked", u'subject', message)
def test_taiga_task_changed_unblocked(self):
# type: () -> None
message = u':unlock: TomaszKolek unblocked task **New Task**.\n'
message = u':unlock: TomaszKolek unblocked task **New Task**.'
self.send_and_test_stream_message("task_changed_unblocked", u'subject', message)
def test_taiga_task_changed_assigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek assigned task **New Task** to TomaszKolek.\n'
message = u':busts_in_silhouette: TomaszKolek assigned task **New Task** to TomaszKolek.'
self.send_and_test_stream_message("task_changed_assigned", u'subject', message)
def test_taiga_task_changed_reassigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek reassigned task **New Task** from HanSolo to TomaszKolek.\n'
message = u':busts_in_silhouette: TomaszKolek reassigned task **New Task** from HanSolo to TomaszKolek.'
self.send_and_test_stream_message("task_changed_reassigned", u'subject', message)
def test_taiga_task_changed_subject(self):
# type: () -> None
message = u':notebook: TomaszKolek renamed task New Task to **New Task Subject**.\n'
message = u':notebook: TomaszKolek renamed task New Task to **New Task Subject**.'
self.send_and_test_stream_message("task_changed_subject", u'subject', message)
def test_taiga_task_changed_description(self):
# type: () -> None
message = u':notebook: TomaszKolek updated description of task **New Task**.\n'
message = u':notebook: TomaszKolek updated description of task **New Task**.'
self.send_and_test_stream_message("task_changed_description", u'subject', message)
def test_taiga_task_deleted(self):
# type: () -> None
message = u':x: TomaszKolek deleted task **New Task**.\n'
message = u':x: TomaszKolek deleted task **New Task**.'
self.send_and_test_stream_message("task_deleted", u'subject', message)
def test_taiga_task_changed_comment_added(self):
# type: () -> None
message = u':thought_balloon: TomaszKolek commented on task **New Task**.\n'
message = u':thought_balloon: TomaszKolek commented on task **New Task**.'
self.send_and_test_stream_message("task_changed_comment_added", u'subject', message)
def test_taiga_sprint_created(self):
# type: () -> None
message = u':calendar: TomaszKolek created sprint **New sprint**.\n'
message = u':calendar: TomaszKolek created sprint **New sprint**.'
self.send_and_test_stream_message("sprint_created", u'subject', message)
def test_taiga_sprint_deleted(self):
# type: () -> None
message = u':x: TomaszKolek deleted sprint **New name**.\n'
message = u':x: TomaszKolek deleted sprint **New name**.'
self.send_and_test_stream_message("sprint_deleted", u'subject', message)
def test_taiga_sprint_changed_time(self):
# type: () -> None
message = u':calendar: TomaszKolek changed estimated finish of sprint **New sprint** from 2017-01-24 to 2017-01-25.\n'
message = u':calendar: TomaszKolek changed estimated finish of sprint **New sprint** from 2017-01-24 to 2017-01-25.'
self.send_and_test_stream_message("sprint_changed_time", u'subject', message)
def test_taiga_sprint_changed_name(self):
# type: () -> None
message = u':notebook: TomaszKolek renamed sprint from New sprint to **New name**.\n'
message = u':notebook: TomaszKolek renamed sprint from New sprint to **New name**.'
self.send_and_test_stream_message("sprint_changed_name", u'subject', message)
def test_taiga_issue_created(self):
# type: () -> None
message = u':bulb: TomaszKolek created issue **New issue**.\n'
message = u':bulb: TomaszKolek created issue **New issue**.'
self.send_and_test_stream_message("issue_created", u'subject', message)
def test_taiga_issue_deleted(self):
# type: () -> None
message = u':x: TomaszKolek deleted issue **New issue**.\n'
message = u':x: TomaszKolek deleted issue **New issue**.'
self.send_and_test_stream_message("issue_deleted", u'subject', message)
def test_taiga_issue_changed_assigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek assigned issue **New issue** to TomaszKolek.\n'
message = u':busts_in_silhouette: TomaszKolek assigned issue **New issue** to TomaszKolek.'
self.send_and_test_stream_message("issue_changed_assigned", u'subject', message)
def test_taiga_issue_changed_reassigned(self):
# type: () -> None
message = u':busts_in_silhouette: TomaszKolek reassigned issue **New issue** from TomaszKolek to HanSolo.\n'
message = u':busts_in_silhouette: TomaszKolek reassigned issue **New issue** from TomaszKolek to HanSolo.'
self.send_and_test_stream_message("issue_changed_reassigned", u'subject', message)
def test_taiga_issue_changed_subject(self):
# type: () -> None
message = u':notebook: TomaszKolek renamed issue New issue to **New issueNewSubject**.\n'
message = u':notebook: TomaszKolek renamed issue New issue to **New issueNewSubject**.'
self.send_and_test_stream_message("issue_changed_subject", u'subject', message)
def test_taiga_issue_changed_description(self):
# type: () -> None
message = u':notebook: TomaszKolek updated description of issue **New issue**.\n'
message = u':notebook: TomaszKolek updated description of issue **New issue**.'
self.send_and_test_stream_message("issue_changed_description", u'subject', message)
def test_taiga_issue_changed_type(self):
# type: () -> None
message = u':bulb: TomaszKolek changed type of issue **New issue** from Bug to Question.\n'
message = u':bulb: TomaszKolek changed type of issue **New issue** from Bug to Question.'
self.send_and_test_stream_message("issue_changed_type", u'subject', message)
def test_taiga_issue_changed_status(self):
# type: () -> None
message = u':chart_with_upwards_trend: TomaszKolek changed status of issue **New issue** from New to In progress.\n'
message = u':chart_with_upwards_trend: TomaszKolek changed status of issue **New issue** from New to In progress.'
self.send_and_test_stream_message("issue_changed_status", u'subject', message)
def test_taiga_issue_changed_severity(self):
# type: () -> None
message = u':warning: TomaszKolek changed severity of issue **New issue** from Normal to Minor.\n'
message = u':warning: TomaszKolek changed severity of issue **New issue** from Normal to Minor.'
self.send_and_test_stream_message("issue_changed_severity", u'subject', message)
def test_taiga_issue_changed_priority(self):
# type: () -> None
message = u':rocket: TomaszKolek changed priority of issue **New issue** from Normal to Low.\n'
message = u':rocket: TomaszKolek changed priority of issue **New issue** from Normal to Low.'
self.send_and_test_stream_message("issue_changed_priority", u'subject', message)
def test_taiga_issue_changed_comment_added(self):
# type: () -> None
message = u':thought_balloon: TomaszKolek commented on issue **New issue**.\n'
message = u':thought_balloon: TomaszKolek commented on issue **New issue**.'
self.send_and_test_stream_message("issue_changed_comment_added", u'subject', message)

View File

@ -50,7 +50,7 @@ class WordPressHookTests(WebhookTestCase):
# type: () -> None
expected_topic = u"New Blog Users"
expected_message = u"New blog user registered.\nName: test_user\nemail: test_user@example.com\n"
expected_message = u"New blog user registered.\nName: test_user\nemail: test_user@example.com"
self.send_and_test_stream_message('user_register', expected_topic, expected_message,
content_type="application/x-www-form-urlencoded")

View File

@ -9,5 +9,5 @@ class ZapierHookTests(WebhookTestCase):
def test_zapier_when_subject_and_body_are_correct(self):
# type: () -> None
expected_subject = u"New email from zulip@zulip.com"
expected_message = u"Your email content is: \nMy Email content.\n"
expected_message = u"Your email content is: \nMy Email content."
self.send_and_test_stream_message('correct_subject_and_body', expected_subject, expected_message)