mirror of https://github.com/zulip/zulip.git
tests: Fix send_message calls in test_notifications.py.
This commit is contained in:
parent
26e51c016d
commit
74943b4120
|
@ -66,9 +66,13 @@ class TestMissedMessages(ZulipTestCase):
|
|||
mock_random_token.side_effect = tokens
|
||||
|
||||
for i in range(0, 11):
|
||||
self.send_message(self.example_email('othello'), "Denmark", Recipient.STREAM, str(i))
|
||||
self.send_message(self.example_email('othello'), "Denmark", Recipient.STREAM, '11', subject='test2')
|
||||
msg_id = self.send_message(self.example_email('othello'), "denmark", Recipient.STREAM, '@**King Hamlet**')
|
||||
self.send_stream_message(self.example_email('othello'), "Denmark", content=str(i))
|
||||
self.send_stream_message(
|
||||
self.example_email('othello'), "Denmark",
|
||||
'11', topic_name='test2')
|
||||
msg_id = self.send_stream_message(
|
||||
self.example_email('othello'), "denmark",
|
||||
'@**King Hamlet**')
|
||||
body = 'Denmark > test Othello, the Moor of Venice 1 2 3 4 5 6 7 8 9 10 @**King Hamlet**'
|
||||
subject = 'Othello, the Moor of Venice mentioned you'
|
||||
self._test_cases(tokens, msg_id, body, subject, send_as_user)
|
||||
|
@ -80,8 +84,10 @@ class TestMissedMessages(ZulipTestCase):
|
|||
mock_random_token.side_effect = tokens
|
||||
|
||||
for i in range(0, 3):
|
||||
self.send_message(self.example_email('cordelia'), "Denmark", Recipient.STREAM, str(i))
|
||||
msg_id = self.send_message(self.example_email('othello'), "Denmark", Recipient.STREAM, '@**King Hamlet**')
|
||||
self.send_stream_message(self.example_email('cordelia'), "Denmark", str(i))
|
||||
msg_id = self.send_stream_message(
|
||||
self.example_email('othello'), "Denmark",
|
||||
'@**King Hamlet**')
|
||||
body = 'Denmark > test Cordelia Lear 0 1 2 Othello, the Moor of Venice @**King Hamlet**'
|
||||
subject = 'Othello, the Moor of Venice mentioned you'
|
||||
self._test_cases(tokens, msg_id, body, subject, send_as_user)
|
||||
|
@ -92,9 +98,11 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'), self.example_email('hamlet'),
|
||||
Recipient.PERSONAL,
|
||||
'Extremely personal message!')
|
||||
msg_id = self.send_personal_message(
|
||||
self.example_email('othello'),
|
||||
self.example_email('hamlet'),
|
||||
'Extremely personal message!',
|
||||
)
|
||||
body = 'You and Othello, the Moor of Venice Extremely personal message!'
|
||||
subject = 'Othello, the Moor of Venice sent you a message'
|
||||
self._test_cases(tokens, msg_id, body, subject, send_as_user)
|
||||
|
@ -105,9 +113,11 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'), self.example_email('hamlet'),
|
||||
Recipient.PERSONAL,
|
||||
'Extremely personal message!')
|
||||
msg_id = self.send_personal_message(
|
||||
self.example_email('othello'),
|
||||
self.example_email('hamlet'),
|
||||
'Extremely personal message!',
|
||||
)
|
||||
body = 'Or just reply to this email.'
|
||||
subject = 'Othello, the Moor of Venice sent you a message'
|
||||
self._test_cases(tokens, msg_id, body, subject, send_as_user)
|
||||
|
@ -118,9 +128,11 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'), self.example_email('hamlet'),
|
||||
Recipient.PERSONAL,
|
||||
'Extremely personal message!')
|
||||
msg_id = self.send_personal_message(
|
||||
self.example_email('othello'),
|
||||
self.example_email('hamlet'),
|
||||
'Extremely personal message!',
|
||||
)
|
||||
body = 'Please do not reply to this automated message.'
|
||||
subject = 'Othello, the Moor of Venice sent you a message'
|
||||
self._test_cases(tokens, msg_id, body, subject, send_as_user)
|
||||
|
@ -131,10 +143,14 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'),
|
||||
[self.example_email('hamlet'), self.example_email('iago')],
|
||||
Recipient.HUDDLE,
|
||||
'Group personal message!')
|
||||
msg_id = self.send_huddle_message(
|
||||
self.example_email('othello'),
|
||||
[
|
||||
self.example_email('hamlet'),
|
||||
self.example_email('iago'),
|
||||
],
|
||||
'Group personal message!',
|
||||
)
|
||||
|
||||
body = ('You and Iago, Othello, the Moor of Venice Othello,'
|
||||
' the Moor of Venice Group personal message')
|
||||
|
@ -147,10 +163,15 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'),
|
||||
[self.example_email('hamlet'), self.example_email('iago'), self.example_email('cordelia')],
|
||||
Recipient.HUDDLE,
|
||||
'Group personal message!')
|
||||
msg_id = self.send_huddle_message(
|
||||
self.example_email('othello'),
|
||||
[
|
||||
self.example_email('hamlet'),
|
||||
self.example_email('iago'),
|
||||
self.example_email('cordelia'),
|
||||
],
|
||||
'Group personal message!',
|
||||
)
|
||||
|
||||
body = ('You and Cordelia Lear, Iago, Othello, the Moor of Venice Othello,'
|
||||
' the Moor of Venice Group personal message')
|
||||
|
@ -163,12 +184,11 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'),
|
||||
msg_id = self.send_huddle_message(self.example_email('othello'),
|
||||
[self.example_email('hamlet'),
|
||||
self.example_email('iago'),
|
||||
self.example_email('cordelia'),
|
||||
self.example_email('prospero')],
|
||||
Recipient.HUDDLE,
|
||||
'Group personal message!')
|
||||
|
||||
body = ('You and Cordelia Lear, Iago, Othello, the Moor of Venice, Prospero from The Tempest'
|
||||
|
@ -182,7 +202,8 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'), "denmark", Recipient.STREAM,
|
||||
msg_id = self.send_stream_message(
|
||||
self.example_email('othello'), "denmark",
|
||||
'@**King Hamlet** to be deleted')
|
||||
|
||||
hamlet = self.example_user('hamlet')
|
||||
|
@ -200,9 +221,8 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'),
|
||||
msg_id = self.send_personal_message(self.example_email('othello'),
|
||||
self.example_email('hamlet'),
|
||||
Recipient.PERSONAL,
|
||||
'Extremely personal message! to be deleted!')
|
||||
|
||||
hamlet = self.example_user('hamlet')
|
||||
|
@ -220,10 +240,14 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'),
|
||||
[self.example_email('hamlet'),
|
||||
self.example_email('iago')],
|
||||
Recipient.PERSONAL, 'Group personal message!')
|
||||
msg_id = self.send_huddle_message(
|
||||
self.example_email('othello'),
|
||||
[
|
||||
self.example_email('hamlet'),
|
||||
self.example_email('iago'),
|
||||
],
|
||||
'Group personal message!',
|
||||
)
|
||||
|
||||
hamlet = self.example_user('hamlet')
|
||||
iago = self.example_user('iago')
|
||||
|
@ -333,8 +357,8 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'), self.example_email('hamlet'),
|
||||
Recipient.PERSONAL,
|
||||
msg_id = self.send_personal_message(
|
||||
self.example_email('othello'), self.example_email('hamlet'),
|
||||
'Extremely personal message with a realm emoji :green_tick:!')
|
||||
body = '<img alt=":green_tick:" style="height: 20px;" src="http://zulip.testserver/user_avatars/1/emoji/green_tick.png" title="green tick">'
|
||||
subject = 'Othello, the Moor of Venice sent you a message'
|
||||
|
@ -346,8 +370,8 @@ class TestMissedMessages(ZulipTestCase):
|
|||
tokens = self._get_tokens()
|
||||
mock_random_token.side_effect = tokens
|
||||
|
||||
msg_id = self.send_message(self.example_email('othello'), self.example_email('hamlet'),
|
||||
Recipient.PERSONAL,
|
||||
msg_id = self.send_personal_message(
|
||||
self.example_email('othello'), self.example_email('hamlet'),
|
||||
'Come and join us in #**Verona**.')
|
||||
body = '<a class="stream" data-stream-id="5" href="http://zulip.testserver/#narrow/stream/Verona">#Verona</a'
|
||||
subject = 'Othello, the Moor of Venice sent you a message'
|
||||
|
@ -360,13 +384,11 @@ class TestMissedMessages(ZulipTestCase):
|
|||
mock_random_token.side_effect = tokens
|
||||
|
||||
hamlet = self.example_user('hamlet')
|
||||
msg_id_1 = self.send_message(self.example_email('othello'),
|
||||
msg_id_1 = self.send_personal_message(self.example_email('othello'),
|
||||
hamlet.email,
|
||||
Recipient.PERSONAL,
|
||||
'Personal Message 1')
|
||||
msg_id_2 = self.send_message(self.example_email('iago'),
|
||||
msg_id_2 = self.send_personal_message(self.example_email('iago'),
|
||||
hamlet.email,
|
||||
Recipient.PERSONAL,
|
||||
'Personal Message 2')
|
||||
|
||||
handle_missedmessage_emails(hamlet.id, [
|
||||
|
|
Loading…
Reference in New Issue