Add test for empty email gateway pattern.

This commit is contained in:
Umair Khan 2016-07-31 19:59:52 +05:00 committed by Tim Abbott
parent 2c07f1b19a
commit 2f6293027d
1 changed files with 18 additions and 0 deletions

View File

@ -39,6 +39,7 @@ import os
import sys
from os.path import dirname, abspath
from six.moves import cStringIO as StringIO
from django.conf import settings
from typing import Any, Callable, Mapping, Union
@ -193,6 +194,23 @@ class TestMissedHuddleMessageEmailMessages(AuthedTestCase):
self.assertEqual(message.sender, get_user_profile_by_email("cordelia@zulip.com"))
self.assertEqual(message.recipient.type, Recipient.HUDDLE)
class TestMissedMessageAddressWithEmptyGateway(AuthedTestCase):
def test_address_with_empty_gateway(self):
self.login("othello@zulip.com")
result = self.client_post("/json/messages", {"type": "private",
"content": "test_receive_missed_message_email_messages",
"client": "test suite",
"to": ujson.dumps(["cordelia@zulip.com",
"iago@zulip.com"])})
self.assert_json_success(result)
user_profile = get_user_profile_by_email("cordelia@zulip.com")
usermessage = most_recent_usermessage(user_profile)
with self.settings(EMAIL_GATEWAY_PATTERN=''):
mm_address = create_missed_message_address(user_profile, usermessage.message)
self.assertEqual(mm_address, settings.NOREPLY_EMAIL_ADDRESS)
class TestDigestEmailMessages(AuthedTestCase):
@mock.patch('zerver.lib.digest.enough_traffic')
@mock.patch('zerver.lib.digest.send_future_email')