test_events: Add a test for do_refer_friend.

This commit is contained in:
Tim Abbott 2017-03-23 21:57:28 -07:00
parent 055a18e71f
commit 0c16cc1c1e
1 changed files with 14 additions and 0 deletions

View File

@ -39,6 +39,7 @@ from zerver.lib.actions import (
do_deactivate_stream,
do_deactivate_user,
do_reactivate_user,
do_refer_friend,
do_regenerate_api_key,
do_remove_alert_words,
do_remove_realm_emoji,
@ -577,6 +578,19 @@ class EventsRegisterTest(ZulipTestCase):
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
def test_referral_events(self):
# type: () -> None
schema_checker = check_dict([
('type', equals('referral')),
('referrals', check_dict([
('granted', check_int),
('used', check_int),
])),
])
events = self.do_test(lambda: do_refer_friend(self.user_profile, "friend@example.com"))
error = schema_checker('events[0]', events[0])
self.assert_on_error(error)
def test_register_events(self):
# type: () -> None
realm_user_add_checker = check_dict([