mentions: Update backend tests to not use only "stream" wildcard.

Use "all" or the set of stream wildcard mentions for backend tests.

Part of project to rename "stream" to "channel".
This commit is contained in:
Lauryn Menard 2024-03-13 19:00:19 +01:00 committed by Tim Abbott
parent dc80f29b8a
commit 92f236ffea
2 changed files with 7 additions and 11 deletions

View File

@ -791,7 +791,7 @@ class TestMessageNotificationEmails(ZulipTestCase):
othello = self.example_user("othello")
stream_wildcard_mentioned_in_followed_topic_message_id = self.send_stream_message(
othello, "Denmark", "@**stream**"
othello, "Denmark", "@**all**"
)
topic_wildcard_mentioned_in_followed_topic_message_id = self.send_stream_message(
othello, "Denmark", "@**topic**"
@ -810,7 +810,7 @@ class TestMessageNotificationEmails(ZulipTestCase):
)
expected_email_include = [
"Othello, the Moor of Venice: > @**stream** > @**topic** -- ",
"Othello, the Moor of Venice: > @**all** > @**topic** -- ",
"You are receiving this because all topic participants were mentioned in #Denmark > test.",
]

View File

@ -4,6 +4,7 @@ from unittest import mock
from django.utils.timezone import now as timezone_now
from zerver.actions.alert_words import do_add_alert_words
from zerver.lib.mention import stream_wildcards
from zerver.lib.soft_deactivation import (
add_missing_messages,
do_auto_soft_deactivate_users,
@ -747,14 +748,9 @@ class SoftDeactivationMessageTest(ZulipTestCase):
# Test UserMessage row is created while user is deactivated if
# there is a stream wildcard mention such as @all or @everyone
for stream_wildcard in stream_wildcards:
assert_stream_message_sent_to_idle_user(
"Test @**all** mention", possible_stream_wildcard_mention=True
)
assert_stream_message_sent_to_idle_user(
"Test @**everyone** mention", possible_stream_wildcard_mention=True
)
assert_stream_message_sent_to_idle_user(
"Test @**stream** mention", possible_stream_wildcard_mention=True
f"Test @**{stream_wildcard}** mention", possible_stream_wildcard_mention=True
)
assert_stream_message_not_sent_to_idle_user("Test @**bogus** mention")