mirror of https://github.com/zulip/zulip.git
webhooks: Add outgoing webhook bot user to development database.
This commit is contained in:
parent
4acc89d379
commit
9cf9837f12
|
@ -413,6 +413,11 @@ class StreamMessagesTest(ZulipTestCase):
|
|||
"""
|
||||
realm = get_realm('zulip')
|
||||
subscribers = self.users_subscribed_to_stream(stream_name, realm)
|
||||
|
||||
# Outgoing webhook bots don't store UserMessage rows; they will be processed later.
|
||||
subscribers = [subscriber for subscriber in subscribers
|
||||
if subscriber.bot_type != UserProfile.OUTGOING_WEBHOOK_BOT]
|
||||
|
||||
old_subscriber_messages = []
|
||||
for subscriber in subscribers:
|
||||
old_subscriber_messages.append(message_stream_count(subscriber))
|
||||
|
|
|
@ -1626,7 +1626,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
set([email1, email2, self.test_email])
|
||||
)
|
||||
|
||||
self.assertEqual(len(add_peer_event['users']), 16)
|
||||
self.assertEqual(len(add_peer_event['users']), 17)
|
||||
self.assertEqual(add_peer_event['event']['type'], 'subscription')
|
||||
self.assertEqual(add_peer_event['event']['op'], 'peer_add')
|
||||
self.assertEqual(add_peer_event['event']['user_id'], self.user_profile.id)
|
||||
|
@ -1656,7 +1656,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
|||
|
||||
# We don't send a peer_add event to othello
|
||||
self.assertNotIn(user_profile.id, add_peer_event['users'])
|
||||
self.assertEqual(len(add_peer_event['users']), 16)
|
||||
self.assertEqual(len(add_peer_event['users']), 17)
|
||||
self.assertEqual(add_peer_event['event']['type'], 'subscription')
|
||||
self.assertEqual(add_peer_event['event']['op'], 'peer_add')
|
||||
self.assertEqual(add_peer_event['event']['user_id'], user_profile.id)
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.utils.timezone import now as timezone_now
|
|||
from zerver.models import Message, UserProfile, Stream, Recipient, UserPresence, \
|
||||
Subscription, get_huddle, Realm, UserMessage, RealmDomain, \
|
||||
clear_database, get_client, get_user_profile_by_id, \
|
||||
email_to_username
|
||||
email_to_username, Service, get_user_profile_by_email
|
||||
from zerver.lib.actions import STREAM_ASSIGNMENT_COLORS, do_send_messages, \
|
||||
do_change_is_admin
|
||||
from django.conf import settings
|
||||
|
@ -255,7 +255,20 @@ class Command(BaseCommand):
|
|||
zulip_webhook_bots = [
|
||||
("Zulip Webhook Bot", "webhook-bot@zulip.com"),
|
||||
]
|
||||
create_users(zulip_realm, zulip_webhook_bots, bot_type=UserProfile.INCOMING_WEBHOOK_BOT)
|
||||
create_users(zulip_realm, zulip_webhook_bots,
|
||||
bot_type=UserProfile.INCOMING_WEBHOOK_BOT)
|
||||
zulip_outgoing_bots = [
|
||||
("Outgoing Webhook", "outgoing-webhook@zulip.com")
|
||||
]
|
||||
create_users(zulip_realm, zulip_outgoing_bots,
|
||||
bot_type=UserProfile.OUTGOING_WEBHOOK_BOT)
|
||||
# TODO: Clean up this initial bot creation code
|
||||
Service.objects.create(
|
||||
name="test",
|
||||
user_profile=get_user_profile_by_email("outgoing-webhook@zulip.com"),
|
||||
base_url="http://127.0.0.1:5002/bots/followup",
|
||||
token="abcd1234",
|
||||
interface=1)
|
||||
|
||||
create_simple_community_realm()
|
||||
|
||||
|
|
Loading…
Reference in New Issue