mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
integration tests: Add check for new messages.
This commit should make it a bit easier to debug integrations that silently don't send any messages.
This commit is contained in:
@@ -631,11 +631,22 @@ class ZulipTestCase(TestCase):
|
|||||||
if stream_name is not None:
|
if stream_name is not None:
|
||||||
self.subscribe(user_profile, stream_name)
|
self.subscribe(user_profile, stream_name)
|
||||||
|
|
||||||
|
prior_msg = self.get_last_message()
|
||||||
|
|
||||||
result = self.client_post(url, payload, **post_params)
|
result = self.client_post(url, payload, **post_params)
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
# Check the correct message was sent
|
# Check the correct message was sent
|
||||||
msg = self.get_last_message()
|
msg = self.get_last_message()
|
||||||
|
|
||||||
|
if msg.id == prior_msg.id:
|
||||||
|
raise Exception('''
|
||||||
|
Your test code called an endpoint that did
|
||||||
|
not write any new messages. It is probably
|
||||||
|
broken (but still returns 200 due to exception
|
||||||
|
handling).
|
||||||
|
''') # nocoverage
|
||||||
|
|
||||||
self.assertEqual(msg.sender.email, user_profile.email)
|
self.assertEqual(msg.sender.email, user_profile.email)
|
||||||
if stream_name is not None:
|
if stream_name is not None:
|
||||||
self.assertEqual(get_display_recipient(msg.recipient), stream_name)
|
self.assertEqual(get_display_recipient(msg.recipient), stream_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user