tests: Move test_near_pm_message_url to test_message_fetch.py.

This commit is contained in:
Mohit Gupta 2020-07-08 06:08:54 +05:30 committed by Tim Abbott
parent 16c3121bc8
commit 79243f7d52
2 changed files with 18 additions and 20 deletions

View File

@ -36,6 +36,7 @@ from zerver.lib.topic import MATCH_TOPIC, TOPIC_NAME
from zerver.lib.topic_mutes import set_topic_mutes
from zerver.lib.types import DisplayRecipientT
from zerver.lib.upload import create_attachment
from zerver.lib.url_encoding import near_message_url
from zerver.models import (
Attachment,
Message,
@ -3217,3 +3218,20 @@ class MessageVisibilityTest(ZulipTestCase):
with mock.patch("zerver.lib.message.update_first_visible_message_id") as m:
maybe_update_first_visible_message_id(realm, lookback_hours)
m.assert_called_once_with(realm)
class PersonalMessagesNearTest(ZulipTestCase):
def test_near_pm_message_url(self) -> None:
realm = get_realm('zulip')
message = dict(
type='personal',
id=555,
display_recipient=[
dict(id=77),
dict(id=80),
],
)
url = near_message_url(
realm=realm,
message=message,
)
self.assertEqual(url, 'http://zulip.testserver/#narrow/pm-with/77,80-pm/near/555')

View File

@ -5,35 +5,15 @@ from django.utils.timezone import now as timezone_now
from zerver.lib.actions import get_active_presence_idle_user_ids, get_client
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.url_encoding import near_message_url
from zerver.models import (
Message,
UserPresence,
UserProfile,
bulk_get_huddle_user_ids,
get_huddle_user_ids,
get_realm,
)
class PersonalMessagesTest(ZulipTestCase):
def test_near_pm_message_url(self) -> None:
realm = get_realm('zulip')
message = dict(
type='personal',
id=555,
display_recipient=[
dict(id=77),
dict(id=80),
],
)
url = near_message_url(
realm=realm,
message=message,
)
self.assertEqual(url, 'http://zulip.testserver/#narrow/pm-with/77,80-pm/near/555')
class MissedMessageTest(ZulipTestCase):
def test_presence_idle_user_ids(self) -> None:
UserPresence.objects.all().delete()