flock: Add test for connection error during message sending.
This commit is contained in:
parent
0fec20239d
commit
935701aea2
|
@ -49,6 +49,15 @@ right now.\nPlease try again later")
|
|||
self.mock_http_conversation('test_found_invalid_recipient'):
|
||||
self.verify_reply('david: hello', bot_response)
|
||||
|
||||
@patch('zulip_bots.bots.flock.flock.get_recipient_id')
|
||||
def test_message_send_connection_error(self, get_recipient_id: str) -> None:
|
||||
bot_response = "Uh-Oh, couldn't process the request right now.\nPlease try again later"
|
||||
get_recipient_id.return_value = ["u:userid", None]
|
||||
with self.mock_config_info(self.normal_config), \
|
||||
patch('requests.get', side_effect=ConnectionError()), \
|
||||
patch('logging.exception'):
|
||||
self.verify_reply('Rishabh: hi there', bot_response)
|
||||
|
||||
@patch('zulip_bots.bots.flock.flock.get_recipient_id')
|
||||
def test_message_send_success(self, get_recipient_id: str) -> None:
|
||||
bot_response = "Message sent."
|
||||
|
|
Loading…
Reference in a new issue