mirror of https://github.com/zulip/zulip.git
Add a couple cross-realm bots.
These are new: new-user-bot emailgateway Our cross-realm bots are hard coded to have email addresses in the `zulip.com` domain, and they're not part of ordinary realms. These have always been cross-realm, but new enforcement in the frontend code of all messages having been sent by a known user means that it's important to add these properly.
This commit is contained in:
parent
415da352df
commit
ae5ba7f4fd
|
@ -2556,7 +2556,7 @@ class FetchQueriesTest(ZulipTestCase):
|
|||
client_gravatar=False,
|
||||
)
|
||||
|
||||
self.assert_length(queries, 30)
|
||||
self.assert_length(queries, 32)
|
||||
|
||||
expected_counts = dict(
|
||||
alert_words=0,
|
||||
|
@ -2575,7 +2575,7 @@ class FetchQueriesTest(ZulipTestCase):
|
|||
realm_embedded_bots=0,
|
||||
realm_emoji=1,
|
||||
realm_filters=1,
|
||||
realm_user=4,
|
||||
realm_user=6,
|
||||
realm_user_groups=1,
|
||||
stream=2,
|
||||
subscription=5,
|
||||
|
|
|
@ -181,8 +181,8 @@ class HomeTest(ZulipTestCase):
|
|||
with patch('zerver.lib.cache.cache_set') as cache_mock:
|
||||
result = self._get_home_page(stream='Denmark')
|
||||
|
||||
self.assert_length(queries, 42)
|
||||
self.assert_length(cache_mock.call_args_list, 10)
|
||||
self.assert_length(queries, 44)
|
||||
self.assert_length(cache_mock.call_args_list, 12)
|
||||
|
||||
html = result.content.decode('utf-8')
|
||||
|
||||
|
@ -246,7 +246,7 @@ class HomeTest(ZulipTestCase):
|
|||
with queries_captured() as queries2:
|
||||
result = self._get_home_page()
|
||||
|
||||
self.assert_length(queries2, 36)
|
||||
self.assert_length(queries2, 38)
|
||||
|
||||
# Do a sanity check that our new streams were in the payload.
|
||||
html = result.content.decode('utf-8')
|
||||
|
@ -470,12 +470,28 @@ class HomeTest(ZulipTestCase):
|
|||
self.assertNotIn('defunct-1@zulip.com', active_emails)
|
||||
|
||||
cross_bots = page_params['cross_realm_bots']
|
||||
self.assertEqual(len(cross_bots), 3)
|
||||
self.assertEqual(len(cross_bots), 5)
|
||||
cross_bots.sort(key=lambda d: d['email'])
|
||||
|
||||
notification_bot = self.notification_bot()
|
||||
|
||||
self.assertEqual(cross_bots, [
|
||||
by_email = lambda d: d['email']
|
||||
|
||||
self.assertEqual(sorted(cross_bots, key=by_email), sorted([
|
||||
dict(
|
||||
user_id=get_user('new-user-bot@zulip.com', get_realm('zulip')).id,
|
||||
is_admin=False,
|
||||
email='new-user-bot@zulip.com',
|
||||
full_name='Zulip New User Bot',
|
||||
is_bot=True
|
||||
),
|
||||
dict(
|
||||
user_id=get_user('emailgateway@zulip.com', get_realm('zulip')).id,
|
||||
is_admin=False,
|
||||
email='emailgateway@zulip.com',
|
||||
full_name='Email Gateway',
|
||||
is_bot=True
|
||||
),
|
||||
dict(
|
||||
user_id=get_user('feedback@zulip.com', get_realm('zulip')).id,
|
||||
is_admin=False,
|
||||
|
@ -497,7 +513,7 @@ class HomeTest(ZulipTestCase):
|
|||
full_name='Welcome Bot',
|
||||
is_bot=True
|
||||
),
|
||||
])
|
||||
], key=by_email))
|
||||
|
||||
def test_new_stream(self):
|
||||
# type: () -> None
|
||||
|
|
|
@ -1474,6 +1474,12 @@ if PRODUCTION:
|
|||
# This is a debugging option only
|
||||
PROFILE_ALL_REQUESTS = False
|
||||
|
||||
CROSS_REALM_BOT_EMAILS = set(('feedback@zulip.com', 'notification-bot@zulip.com', 'welcome-bot@zulip.com'))
|
||||
CROSS_REALM_BOT_EMAILS = {
|
||||
'feedback@zulip.com',
|
||||
'notification-bot@zulip.com',
|
||||
'welcome-bot@zulip.com',
|
||||
'new-user-bot@zulip.com',
|
||||
'emailgateway@zulip.com',
|
||||
}
|
||||
|
||||
CONTRIBUTORS_DATA = os.path.join(STATIC_ROOT, 'generated/github-contributors.json')
|
||||
|
|
Loading…
Reference in New Issue