From 7b3c083ab5e1c64eaa00c5420e2ac3b718a0e566 Mon Sep 17 00:00:00 2001 From: novokrest Date: Sun, 10 Jun 2018 10:52:30 +0300 Subject: [PATCH] flock: Refactor `test_no_recipient_found` test to increase coverage. --- .../bots/flock/fixtures/test_no_recipient_found.json | 9 ++++++--- zulip_bots/zulip_bots/bots/flock/test_flock.py | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/flock/fixtures/test_no_recipient_found.json b/zulip_bots/zulip_bots/bots/flock/fixtures/test_no_recipient_found.json index 4efab90..a7264bf 100644 --- a/zulip_bots/zulip_bots/bots/flock/fixtures/test_no_recipient_found.json +++ b/zulip_bots/zulip_bots/bots/flock/fixtures/test_no_recipient_found.json @@ -6,9 +6,12 @@ "token": "12345" } }, - "response": { - "error": "No user found. Make sure you typed it correctly." - }, + "response": [ + { + "id": 1, + "firstName": "user1" + } + ], "response-headers": { "content-type": "application/json; charset=utf-8" } diff --git a/zulip_bots/zulip_bots/bots/flock/test_flock.py b/zulip_bots/zulip_bots/bots/flock/test_flock.py index b5c1f14..f1cb4b2 100644 --- a/zulip_bots/zulip_bots/bots/flock/test_flock.py +++ b/zulip_bots/zulip_bots/bots/flock/test_flock.py @@ -37,10 +37,8 @@ right now.\nPlease try again later") self.verify_reply('Ricky: test message', "Uh-Oh, couldn\'t process the request \ right now.\nPlease try again later") - @patch('zulip_bots.bots.flock.flock.find_recipient_id') - def test_no_recipient_found(self, find_recipient: str) -> None: + def test_no_recipient_found(self) -> None: bot_response = "No user found. Make sure you typed it correctly." - find_recipient.return_value = None with self.mock_config_info(self.normal_config), \ self.mock_http_conversation('test_no_recipient_found'): self.verify_reply('david: hello', bot_response)