Add test for do_deactivate_realm exit if deactivated.

Rename existing test_do_deactivate_realm to indicate test purpose
is to confirm user realm cache clears when a realm is deactivated.
This commit is contained in:
kb0rg
2017-05-23 16:26:30 -07:00
committed by Tim Abbott
parent e672ec62c1
commit eb2d0ebd09

View File

@@ -128,7 +128,7 @@ class RealmTest(ZulipTestCase):
# Since the setting fails silently, no message is returned # Since the setting fails silently, no message is returned
self.assert_in_response("", result) self.assert_in_response("", result)
def test_do_deactivate_realm(self): def test_do_deactivate_realm_clears_user_realm_cache(self):
# type: () -> None # type: () -> None
"""The main complicated thing about deactivating realm names is """The main complicated thing about deactivating realm names is
updating the cache, and we start by populating the cache for updating the cache, and we start by populating the cache for
@@ -141,6 +141,18 @@ class RealmTest(ZulipTestCase):
user = self.example_user('hamlet') user = self.example_user('hamlet')
self.assertTrue(user.realm.deactivated) self.assertTrue(user.realm.deactivated)
def test_do_deactivate_realm_on_deactived_realm(self):
# type: () -> None
"""Ensure early exit is working in realm deactivation"""
realm = get_realm('zulip')
self.assertFalse(realm.deactivated)
do_deactivate_realm(realm)
self.assertTrue(realm.deactivated)
do_deactivate_realm(realm)
self.assertTrue(realm.deactivated)
def test_change_realm_default_language(self): def test_change_realm_default_language(self):
# type: () -> None # type: () -> None
new_lang = "de" new_lang = "de"