From 8c3eaeb872a96eb20623ef7289829b1e6c684822 Mon Sep 17 00:00:00 2001 From: Steve Howell Date: Tue, 11 Feb 2020 15:55:16 +0000 Subject: [PATCH] Remove obsolete internal_send_messages(). We have been phasing this out for a couple years, and I fixed the last stragglers over the last couple days. --- zerver/lib/actions.py | 30 ------------------------------ zerver/tests/test_messages.py | 14 -------------- 2 files changed, 44 deletions(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 62a9ad0c8f..df198c7898 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -2515,36 +2515,6 @@ def internal_prep_private_message(realm: Realm, content=content, ) -def internal_send_message(realm: Realm, sender_email: str, recipient_type_name: str, - recipients: str, topic_name: str, content: str) -> Optional[int]: - """internal_send_message should only be used where `sender_email` is a - system bot.""" - - # Verify the user is in fact a system bot - assert(is_cross_realm_bot_email(sender_email) or sender_email == settings.ERROR_BOT) - - sender = get_system_bot(sender_email) - parsed_recipients = extract_recipients(recipients) - - addressee = Addressee.legacy_build( - sender, - recipient_type_name, - parsed_recipients, - topic_name, - realm=realm) - - msg = _internal_prep_message( - realm=realm, - sender=sender, - addressee=addressee, - content=content, - ) - if msg is None: - return None - - message_ids = do_send_messages([msg]) - return message_ids[0] - def internal_send_private_message(realm: Realm, sender: UserProfile, recipient_user: UserProfile, diff --git a/zerver/tests/test_messages.py b/zerver/tests/test_messages.py index 5fe9ab1d29..b1d2c1705e 100644 --- a/zerver/tests/test_messages.py +++ b/zerver/tests/test_messages.py @@ -33,7 +33,6 @@ from zerver.lib.actions import ( internal_prep_private_message, internal_prep_stream_message_by_name, internal_send_huddle_message, - internal_send_message, internal_send_private_message, internal_send_stream_message, internal_send_stream_message_by_name, @@ -567,19 +566,6 @@ class InternalPrepTest(ZulipTestCase): arg = m.call_args_list[0][0][0] self.assertIn('Message must not be empty', arg) - with mock.patch('logging.exception') as m: - internal_send_message( - realm=realm, - sender_email=settings.ERROR_BOT, - recipient_type_name='stream', - recipients=stream.name, - topic_name='whatever', - content=bad_content, - ) - - arg = m.call_args_list[0][0][0] - self.assertIn('Message must not be empty', arg) - def test_error_handling(self) -> None: realm = get_realm('zulip') sender = self.example_user('cordelia')