test_events: Add comments for do_test_subscribe_events.

This commit is contained in:
Tim Abbott 2017-02-22 00:34:12 -08:00
parent aa6567ee34
commit 160891381a
1 changed files with 5 additions and 0 deletions

View File

@ -1102,12 +1102,14 @@ class EventsRegisterTest(ZulipTestCase):
('name', check_string),
])
# Subscribe to a totally new stream, so it's just Hamlet on it
action = lambda: self.subscribe_to_stream("hamlet@zulip.com", "test_stream") # type: Callable
events = self.do_test(action, event_types=["subscription", "realm_user"],
include_subscribers=include_subscribers)
error = add_schema_checker('events[0]', events[0])
self.assert_on_error(error)
# Add another user to that totally new stream
action = lambda: self.subscribe_to_stream("othello@zulip.com", "test_stream")
events = self.do_test(action,
include_subscribers=include_subscribers,
@ -1118,6 +1120,7 @@ class EventsRegisterTest(ZulipTestCase):
stream = get_stream("test_stream", self.user_profile.realm)
# Now remove the first user, to test the normal unsubscribe flow
action = lambda: bulk_remove_subscriptions(
[get_user_profile_by_email("othello@zulip.com")],
[stream])
@ -1128,6 +1131,7 @@ class EventsRegisterTest(ZulipTestCase):
error = peer_remove_schema_checker('events[0]', events[0])
self.assert_on_error(error)
# Now remove the second user, to test the 'vacate' event flow
action = lambda: bulk_remove_subscriptions(
[get_user_profile_by_email("hamlet@zulip.com")],
[stream])
@ -1136,6 +1140,7 @@ class EventsRegisterTest(ZulipTestCase):
error = remove_schema_checker('events[1]', events[1])
self.assert_on_error(error)
# Now resubscribe a user, to make sure that works on a vacated stream
action = lambda: self.subscribe_to_stream("hamlet@zulip.com", "test_stream")
events = self.do_test(action,
include_subscribers=include_subscribers)