mirror of
https://github.com/zulip/zulip.git
synced 2025-11-21 15:09:34 +00:00
test_presence: Prepare for moving system bots to zulipinternal.
These tests want a "local realm" bot rather than a cross-realm bot (welcome-bot).
This commit is contained in:
committed by
Tim Abbott
parent
1702ff3a0b
commit
d6f9ea94fc
@@ -499,7 +499,7 @@ class GetRealmStatusesTest(ZulipTestCase):
|
|||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
|
|
||||||
# Check that a bot can fetch the presence data for the realm.
|
# Check that a bot can fetch the presence data for the realm.
|
||||||
result = self.api_get(self.example_email("welcome_bot"), "/api/v1/realm/presence")
|
result = self.api_get(self.example_email("default_bot"), "/api/v1/realm/presence")
|
||||||
self.assert_json_success(result)
|
self.assert_json_success(result)
|
||||||
json = result.json()
|
json = result.json()
|
||||||
self.assertEqual(sorted(json['presences'].keys()), [hamlet_email, othello_email])
|
self.assertEqual(sorted(json['presences'].keys()), [hamlet_email, othello_email])
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
from zerver.lib.actions import internal_send_private_message
|
||||||
from zerver.lib.test_classes import ZulipTestCase
|
from zerver.lib.test_classes import ZulipTestCase
|
||||||
from zerver.lib.test_helpers import message_stream_count, most_recent_message
|
from zerver.lib.test_helpers import message_stream_count, most_recent_message
|
||||||
from zerver.models import get_realm, get_user, UserProfile
|
from zerver.models import get_realm, get_user, get_system_bot, UserProfile
|
||||||
|
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
@@ -11,10 +13,10 @@ class TutorialTests(ZulipTestCase):
|
|||||||
# This emulates the welcome message sent by the welcome bot to hamlet@zulip.com
|
# This emulates the welcome message sent by the welcome bot to hamlet@zulip.com
|
||||||
# This is only a quick fix - ideally, we would have this message sent by the initialization
|
# This is only a quick fix - ideally, we would have this message sent by the initialization
|
||||||
# code in populate_db.py
|
# code in populate_db.py
|
||||||
user_email = 'hamlet@zulip.com'
|
user = self.example_user('hamlet')
|
||||||
bot_email = 'welcome-bot@zulip.com'
|
welcome_bot = get_system_bot(settings.WELCOME_BOT)
|
||||||
content = 'Shortened welcome message.'
|
content = 'Shortened welcome message.'
|
||||||
self.send_personal_message(bot_email, user_email, content)
|
internal_send_private_message(welcome_bot.realm, welcome_bot, user, content)
|
||||||
|
|
||||||
def test_tutorial_status(self) -> None:
|
def test_tutorial_status(self) -> None:
|
||||||
email = self.example_email('hamlet')
|
email = self.example_email('hamlet')
|
||||||
|
|||||||
Reference in New Issue
Block a user