mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 20:41:46 +00:00
test_classes: Remove domain from ZulipTestCase.register.
This commit is contained in:
@@ -188,9 +188,8 @@ class ZulipTestCase(TestCase):
|
|||||||
else:
|
else:
|
||||||
self.assertFalse(self.client.login(username=email, password=password))
|
self.assertFalse(self.client.login(username=email, password=password))
|
||||||
|
|
||||||
def register(self, username, password, domain="zulip.com"):
|
def register(self, email, password):
|
||||||
# type: (Text, Text, Text) -> HttpResponse
|
# type: (Text, Text) -> HttpResponse
|
||||||
email = username + "@" + domain
|
|
||||||
self.client_post('/accounts/home/', {'email': email})
|
self.client_post('/accounts/home/', {'email': email})
|
||||||
return self.submit_reg_form_for_user(email, password)
|
return self.submit_reg_form_for_user(email, password)
|
||||||
|
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ class EventsRegisterTest(ZulipTestCase):
|
|||||||
])))
|
])))
|
||||||
])
|
])
|
||||||
|
|
||||||
events = self.do_test(lambda: self.register("test1", "test1"))
|
events = self.do_test(lambda: self.register("test1@zulip.com", "test1"))
|
||||||
error = realm_user_add_checker('events[0]', events[0])
|
error = realm_user_add_checker('events[0]', events[0])
|
||||||
self.assert_on_error(error)
|
self.assert_on_error(error)
|
||||||
error = stream_create_checker('events[1]', events[1])
|
error = stream_create_checker('events[1]', events[1])
|
||||||
|
|||||||
@@ -163,8 +163,7 @@ class TestCrossRealmPMs(ZulipTestCase):
|
|||||||
|
|
||||||
def create_user(self, email):
|
def create_user(self, email):
|
||||||
# type: (Text) -> UserProfile
|
# type: (Text) -> UserProfile
|
||||||
username, domain = email.split('@')
|
self.register(email, 'test')
|
||||||
self.register(username, 'test', domain=domain)
|
|
||||||
return get_user_profile_by_email(email)
|
return get_user_profile_by_email(email)
|
||||||
|
|
||||||
@override_settings(CROSS_REALM_BOT_EMAILS=['feedback@zulip.com',
|
@override_settings(CROSS_REALM_BOT_EMAILS=['feedback@zulip.com',
|
||||||
@@ -273,7 +272,7 @@ class PersonalMessagesTest(ZulipTestCase):
|
|||||||
Newly created users are auto-subbed to the ability to receive
|
Newly created users are auto-subbed to the ability to receive
|
||||||
personals.
|
personals.
|
||||||
"""
|
"""
|
||||||
self.register("test", "test")
|
self.register("test@zulip.com", "test")
|
||||||
user_profile = get_user_profile_by_email('test@zulip.com')
|
user_profile = get_user_profile_by_email('test@zulip.com')
|
||||||
old_messages_count = message_stream_count(user_profile)
|
old_messages_count = message_stream_count(user_profile)
|
||||||
self.send_message("test@zulip.com", "test@zulip.com", Recipient.PERSONAL)
|
self.send_message("test@zulip.com", "test@zulip.com", Recipient.PERSONAL)
|
||||||
@@ -302,7 +301,7 @@ class PersonalMessagesTest(ZulipTestCase):
|
|||||||
If you send a personal to yourself, only you see it.
|
If you send a personal to yourself, only you see it.
|
||||||
"""
|
"""
|
||||||
old_user_profiles = list(UserProfile.objects.all())
|
old_user_profiles = list(UserProfile.objects.all())
|
||||||
self.register("test1", "test1")
|
self.register("test1@zulip.com", "test1")
|
||||||
|
|
||||||
old_messages = []
|
old_messages = []
|
||||||
for user_profile in old_user_profiles:
|
for user_profile in old_user_profiles:
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ class AddNewUserHistoryTest(ZulipTestCase):
|
|||||||
} # type: Dict[Text, Dict[Text, Any]]
|
} # type: Dict[Text, Dict[Text, Any]]
|
||||||
set_default_streams(get_realm("zulip"), stream_dict)
|
set_default_streams(get_realm("zulip"), stream_dict)
|
||||||
with patch("zerver.lib.actions.add_new_user_history"):
|
with patch("zerver.lib.actions.add_new_user_history"):
|
||||||
self.register("test", "test")
|
self.register("test@zulip.com", "test")
|
||||||
user_profile = get_user_profile_by_email("test@zulip.com")
|
user_profile = get_user_profile_by_email("test@zulip.com")
|
||||||
|
|
||||||
subs = Subscription.objects.select_related("recipient").filter(
|
subs = Subscription.objects.select_related("recipient").filter(
|
||||||
@@ -258,7 +258,7 @@ class LoginTest(ZulipTestCase):
|
|||||||
|
|
||||||
set_default_streams(realm, stream_dict)
|
set_default_streams(realm, stream_dict)
|
||||||
with queries_captured() as queries:
|
with queries_captured() as queries:
|
||||||
self.register("test", "test")
|
self.register("test@zulip.com", "test")
|
||||||
# Ensure the number of queries we make is not O(streams)
|
# Ensure the number of queries we make is not O(streams)
|
||||||
self.assert_max_length(queries, 69)
|
self.assert_max_length(queries, 69)
|
||||||
user_profile = get_user_profile_by_email('test@zulip.com')
|
user_profile = get_user_profile_by_email('test@zulip.com')
|
||||||
@@ -275,7 +275,7 @@ class LoginTest(ZulipTestCase):
|
|||||||
realm.deactivated = True
|
realm.deactivated = True
|
||||||
realm.save(update_fields=["deactivated"])
|
realm.save(update_fields=["deactivated"])
|
||||||
|
|
||||||
result = self.register("test", "test")
|
result = self.register("test@zulip.com", "test")
|
||||||
self.assert_in_response("has been deactivated", result)
|
self.assert_in_response("has been deactivated", result)
|
||||||
|
|
||||||
with self.assertRaises(UserProfile.DoesNotExist):
|
with self.assertRaises(UserProfile.DoesNotExist):
|
||||||
@@ -308,7 +308,7 @@ class LoginTest(ZulipTestCase):
|
|||||||
password = u"hümbüǵ"
|
password = u"hümbüǵ"
|
||||||
|
|
||||||
# Registering succeeds.
|
# Registering succeeds.
|
||||||
self.register("test", password)
|
self.register("test@zulip.com", password)
|
||||||
user_profile = get_user_profile_by_email(email)
|
user_profile = get_user_profile_by_email(email)
|
||||||
self.assertEqual(get_session_dict_user(self.client.session), user_profile.id)
|
self.assertEqual(get_session_dict_user(self.client.session), user_profile.id)
|
||||||
self.client_post('/accounts/logout/')
|
self.client_post('/accounts/logout/')
|
||||||
|
|||||||
Reference in New Issue
Block a user