sent_by_human: Add "test suite" to the set of Zulip UI-style clients.

Earlier, when we used 'self.send_message()' in the backend tests,
the sent message was not marked as read for the sender.

Reason: To set the read flag, we have to check if
'message.sent_by_human()'. It returns False because the
'sending_client' for tests is "test suite" and the 'sent_by_human'
function doesn't enlist the "test suite" client name as a human client.

This commit adds "test suite" to that list.

Also fixes a bug in when apply_unread_message_event was called that
was revealed by this change.
This commit is contained in:
Prakhar Pratyush
2023-09-30 16:10:39 +05:30
committed by Tim Abbott
parent 68abc6af21
commit c349d1137c
7 changed files with 87 additions and 63 deletions

View File

@@ -3111,20 +3111,26 @@ class Message(AbstractMessage):
sending_client = self.sending_client.name.lower()
return (
sending_client
in (
"zulipandroid",
"zulipios",
"zulipdesktop",
"zulipmobile",
"zulipelectron",
"zulipterminal",
"snipe",
"website",
"ios",
"android",
(
sending_client
in (
"zulipandroid",
"zulipios",
"zulipdesktop",
"zulipmobile",
"zulipelectron",
"zulipterminal",
"snipe",
"website",
"ios",
"android",
)
)
) or ("desktop app" in sending_client)
or ("desktop app" in sending_client)
# Since the vast majority of messages are sent by humans
# in Zulip, treat test suite messages as such.
or (sending_client == "test suite" and settings.TEST_SUITE)
)
@staticmethod
def is_status_message(content: str, rendered_content: str) -> bool: