mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
test_outgoing_webhook_interfaces: Don’t mock an unused import.
We eliminated use of this function in outgoing_webhook.py in
bdc95b5d72.
Tweaked by tabbott to also eliminate code only used for that mock.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
committed by
Tim Abbott
parent
56a675d5ec
commit
023f8a0def
@@ -13,7 +13,7 @@ from requests import Response
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from zerver.models import Realm, UserProfile, get_user_profile_by_id, get_client, \
|
||||
GENERIC_INTERFACE, Service, SLACK_INTERFACE, email_to_domain, get_service_profile
|
||||
GENERIC_INTERFACE, Service, SLACK_INTERFACE, email_to_domain
|
||||
from zerver.lib.actions import check_send_message
|
||||
from zerver.lib.queue import retry_event
|
||||
from zerver.lib.topic import get_topic_from_message_info
|
||||
|
||||
@@ -11,7 +11,7 @@ from zerver.lib.outgoing_webhook import (
|
||||
)
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
from zerver.lib.topic import TOPIC_NAME
|
||||
from zerver.models import Service, get_realm, get_user, SLACK_INTERFACE
|
||||
from zerver.models import get_realm, get_user, SLACK_INTERFACE
|
||||
|
||||
class TestGenericOutgoingWebhookService(ZulipTestCase):
|
||||
|
||||
@@ -95,8 +95,6 @@ class TestGenericOutgoingWebhookService(ZulipTestCase):
|
||||
success_response = self.handler.process_success(response, self.event)
|
||||
self.assertEqual(success_response, None)
|
||||
|
||||
mock_service = Service()
|
||||
|
||||
class TestSlackOutgoingWebhookService(ZulipTestCase):
|
||||
|
||||
def setUp(self) -> None:
|
||||
@@ -156,10 +154,8 @@ class TestSlackOutgoingWebhookService(ZulipTestCase):
|
||||
self.assertEqual(request_data[9][1], "mention") # trigger_word
|
||||
self.assertEqual(request_data[10][1], 12) # user_profile_id
|
||||
|
||||
@mock.patch('zerver.lib.outgoing_webhook.get_service_profile', return_value=mock_service)
|
||||
@mock.patch('zerver.lib.outgoing_webhook.fail_with_message')
|
||||
def test_build_bot_request_private_message(self, mock_fail_with_message: mock.Mock,
|
||||
mock_get_service_profile: mock.Mock) -> None:
|
||||
def test_build_bot_request_private_message(self, mock_fail_with_message: mock.Mock) -> None:
|
||||
|
||||
request_data = self.handler.build_bot_request(self.private_message_event)
|
||||
self.assertIsNone(request_data)
|
||||
|
||||
Reference in New Issue
Block a user