test_events: Add a test for do_update_embedded_data.

This commit is contained in:
Tim Abbott 2017-03-23 21:54:20 -07:00
parent eb19a25aba
commit 055a18e71f
1 changed files with 22 additions and 0 deletions

View File

@ -50,6 +50,7 @@ from zerver.lib.actions import (
do_set_realm_property,
do_set_realm_authentication_methods,
do_set_realm_message_editing,
do_update_embedded_data,
do_update_message,
do_update_message_flags,
do_update_muted_topic,
@ -383,6 +384,7 @@ class EventsRegisterTest(ZulipTestCase):
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
# Verify message editing
schema_checker = check_dict([
('type', equals('update_message')),
('flags', check_list(None)),
@ -418,6 +420,26 @@ class EventsRegisterTest(ZulipTestCase):
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
# Verify do_update_embedded_data
schema_checker = check_dict([
('type', equals('update_message')),
('flags', check_list(None)),
('content', check_string),
('flags', check_list(None)),
('message_id', check_int),
('message_ids', check_list(check_int)),
('rendered_content', check_string),
('sender', check_string),
])
events = self.do_test(
lambda: do_update_embedded_data(self.user_profile, message,
u"embed_content", "<p>embed_content</p>"),
state_change_expected=False,
)
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
def test_update_message_flags(self):
# type: () -> None
# Test message flag update events