Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
tests: Move test_auto_subbed_to_personals test to test_signup.py.
Mohit Guptab0b3cf86cee8
diff --git a/zerver/tests/test_messages.py b/zerver/tests/test_messages.pyindex 55f0c2bab5f..17c41020905 100644--- a/zerver/tests/test_messages.py+++ b/zerver/tests/test_messages.py@@ -1,20 +1,13 @@import datetimefrom typing import Dict, List-from unittest import mockfrom django.utils.timezone import now as timezone_nowfrom zerver.lib.actions import get_active_presence_idle_user_ids, get_clientfrom zerver.lib.test_classes import ZulipTestCase-from zerver.lib.test_helpers import (- message_stream_count,- most_recent_message,- most_recent_usermessage,-)from zerver.lib.url_encoding import near_message_urlfrom zerver.models import (Message,- Recipient,UserPresence,UserProfile,bulk_get_huddle_user_ids,@@ -53,36 +46,6 @@ class PersonalMessagesTest(ZulipTestCase):for msg in self.get_messages():self.assertNotIn('is_private', msg['flags'])- def test_auto_subbed_to_personals(self) -> None:- """- Newly created users are auto-subbed to the ability to receive- personals.- """- test_email = self.nonreg_email('test')- self.register(test_email, "test")- user_profile = self.nonreg_user('test')- old_messages_count = message_stream_count(user_profile)- self.send_personal_message(user_profile, user_profile)- new_messages_count = message_stream_count(user_profile)- self.assertEqual(new_messages_count, old_messages_count + 1)-- recipient = Recipient.objects.get(type_id=user_profile.id,- type=Recipient.PERSONAL)- message = most_recent_message(user_profile)- self.assertEqual(message.recipient, recipient)-- with mock.patch('zerver.models.get_display_recipient', return_value='recip'):- self.assertEqual(- str(message),- '<Message: recip / / '- '<UserProfile: {} {}>>'.format(user_profile.email, user_profile.realm))-- user_message = most_recent_usermessage(user_profile)- self.assertEqual(- str(user_message),- f'<UserMessage: recip / {user_profile.email} ([])>',- )-class MissedMessageTest(ZulipTestCase):def test_presence_idle_user_ids(self) -> None:UserPresence.objects.all().delete()diff --git a/zerver/tests/test_signup.py b/zerver/tests/test_signup.pyindex b4de901506b..0065204a6da 100644--- a/zerver/tests/test_signup.py+++ b/zerver/tests/test_signup.py@@ -68,6 +68,9 @@ from zerver.lib.test_helpers import (find_key_by_email,get_test_image_file,load_subdomain_token,+ message_stream_count,+ most_recent_message,+ most_recent_usermessage,queries_captured,reset_emails_in_zulip_realm,)@@ -226,6 +229,36 @@ class AddNewUserHistoryTest(ZulipTestCase):for msg in older_messages:self.assertTrue(msg.flags.read.is_set)+ def test_auto_subbed_to_personals(self) -> None:+ """+ Newly created users are auto-subbed to the ability to receive+ personals.+ """+ test_email = self.nonreg_email('test')+ self.register(test_email, "test")+ user_profile = self.nonreg_user('test')+ old_messages_count = message_stream_count(user_profile)+ self.send_personal_message(user_profile, user_profile)+ new_messages_count = message_stream_count(user_profile)+ self.assertEqual(new_messages_count, old_messages_count + 1)++ recipient = Recipient.objects.get(type_id=user_profile.id,+ type=Recipient.PERSONAL)+ message = most_recent_message(user_profile)+ self.assertEqual(message.recipient, recipient)++ with patch('zerver.models.get_display_recipient', return_value='recip'):+ self.assertEqual(+ str(message),+ '<Message: recip / / '+ '<UserProfile: {} {}>>'.format(user_profile.email, user_profile.realm))++ user_message = most_recent_usermessage(user_profile)+ self.assertEqual(+ str(user_message),+ f'<UserMessage: recip / {user_profile.email} ([])>',+ )+class InitialPasswordTest(ZulipTestCase):def test_none_initial_password_salt(self) -> None:with self.settings(INITIAL_PASSWORD_SALT=None):