flock: Fix error message for invalid user.
This commit is contained in:
parent
7b3c083ab5
commit
0fec20239d
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"request": {
|
||||
"api_url": "https://api.flock.co/v1/roster.listContacts",
|
||||
"method": "GET",
|
||||
"params": {
|
||||
"token": "12345"
|
||||
}
|
||||
},
|
||||
"response": [
|
||||
{
|
||||
"id": 1234567890123456789012345678901,
|
||||
"firstName": "david"
|
||||
}
|
||||
],
|
||||
"response-headers": {
|
||||
"content-type": "application/json; charset=utf-8"
|
||||
}
|
||||
}
|
|
@ -62,7 +62,7 @@ def get_flock_response(content: str, config: Dict[str, str]) -> str:
|
|||
return error
|
||||
|
||||
if len(str(recipient_id)) > 30:
|
||||
return recipient_id
|
||||
return "Found user is invalid."
|
||||
|
||||
payload = {
|
||||
'to': recipient_id,
|
||||
|
|
|
@ -43,6 +43,12 @@ right now.\nPlease try again later")
|
|||
self.mock_http_conversation('test_no_recipient_found'):
|
||||
self.verify_reply('david: hello', bot_response)
|
||||
|
||||
def test_found_invalid_recipient(self) -> None:
|
||||
bot_response = "Found user is invalid."
|
||||
with self.mock_config_info(self.normal_config), \
|
||||
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_success(self, get_recipient_id: str) -> None:
|
||||
bot_response = "Message sent."
|
||||
|
|
Loading…
Reference in a new issue