test_events.py: Add a test for the do_change_realm_alias() function.

This commit is contained in:
Harshit Bansal
2017-02-10 03:14:03 +05:30
committed by Tim Abbott
parent fec145fc0c
commit 21dccaedd1
2 changed files with 19 additions and 2 deletions

View File

@@ -314,6 +314,10 @@ def apply_events(state, events, user_profile):
elif event['type'] == "realm_domains":
if event['op'] == 'add':
state['realm_domains'].append(event['alias'])
elif event['op'] == 'change':
for realm_domain in state['realm_domains']:
if realm_domain['domain'] == event['alias']['domain']:
realm_domain['allow_subdomains'] = event['alias']['allow_subdomains']
elif event['op'] == 'remove':
state['realm_domains'] = [alias for alias in state['realm_domains'] if alias['domain'] != event['domain']]
elif event['type'] == "realm_emoji":