flock: Refactor test_no_recipient_found test to increase coverage.

This commit is contained in:
novokrest 2018-06-10 10:52:30 +03:00 committed by showell
parent 80adce3cee
commit 7b3c083ab5
2 changed files with 7 additions and 6 deletions

View file

@ -6,9 +6,12 @@
"token": "12345" "token": "12345"
} }
}, },
"response": { "response": [
"error": "No user found. Make sure you typed it correctly." {
}, "id": 1,
"firstName": "user1"
}
],
"response-headers": { "response-headers": {
"content-type": "application/json; charset=utf-8" "content-type": "application/json; charset=utf-8"
} }

View file

@ -37,10 +37,8 @@ right now.\nPlease try again later")
self.verify_reply('Ricky: test message', "Uh-Oh, couldn\'t process the request \ self.verify_reply('Ricky: test message', "Uh-Oh, couldn\'t process the request \
right now.\nPlease try again later") right now.\nPlease try again later")
@patch('zulip_bots.bots.flock.flock.find_recipient_id') def test_no_recipient_found(self) -> None:
def test_no_recipient_found(self, find_recipient: str) -> None:
bot_response = "No user found. Make sure you typed it correctly." bot_response = "No user found. Make sure you typed it correctly."
find_recipient.return_value = None
with self.mock_config_info(self.normal_config), \ with self.mock_config_info(self.normal_config), \
self.mock_http_conversation('test_no_recipient_found'): self.mock_http_conversation('test_no_recipient_found'):
self.verify_reply('david: hello', bot_response) self.verify_reply('david: hello', bot_response)