mirror of
https://github.com/zulip/zulip.git
synced 2025-11-13 10:26:28 +00:00
Add basic test for FeedbackBot.
This sets up a new test class with a simple test, mostly for increasing coverage. The class should in the future be extended to properly verify the handle_feedback() logic.
This commit is contained in:
@@ -1277,7 +1277,6 @@ def do_send_messages(messages_maybe_none: Sequence[Optional[MutableMapping[str,
|
||||
queue_json_publish(
|
||||
'feedback_messages',
|
||||
wide_message_dict,
|
||||
lambda x: None
|
||||
)
|
||||
|
||||
if message['message'].recipient.type == Recipient.PERSONAL:
|
||||
|
||||
12
zerver/tests/test_feedback.py
Normal file
12
zerver/tests/test_feedback.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from unittest.mock import patch, MagicMock
|
||||
from django.conf import settings
|
||||
from zerver.lib.test_classes import ZulipTestCase
|
||||
|
||||
class TestFeedbackBot(ZulipTestCase):
|
||||
@patch('logging.info')
|
||||
def test_pm_to_feedback_bot(self, logging_info_mock: MagicMock) -> None:
|
||||
with self.settings(ENABLE_FEEDBACK=True):
|
||||
user_email = self.example_email("othello")
|
||||
self.send_personal_message(user_email, settings.FEEDBACK_BOT,
|
||||
content="I am a feedback message.")
|
||||
logging_info_mock.assert_called_once_with("Received feedback from {}".format(user_email))
|
||||
Reference in New Issue
Block a user