flock: Rename method find_recipient
to find_recipient_id
.
This commit is contained in:
parent
0a7a06f028
commit
c2a3d4c517
|
@ -13,7 +13,7 @@ You can send messages to any Flock user associated with your account from Zulip.
|
|||
|
||||
# Matches the recipient name provided by user with list of users in his contacts.
|
||||
# If matches, returns the matched User's ID
|
||||
def find_recipient(res: str, recipient_name: str) -> str:
|
||||
def find_recipient_id(res: str, recipient_name: str) -> str:
|
||||
for obj in res:
|
||||
if recipient_name == obj['firstName']:
|
||||
return obj['id']
|
||||
|
@ -33,7 +33,7 @@ def get_recipient_id(recipient_name: str, config: Dict[str, str]) -> str:
|
|||
right now.\nPlease try again later"
|
||||
|
||||
res = res.json()
|
||||
recipient_id = find_recipient(res, recipient_name)
|
||||
recipient_id = find_recipient_id(res, recipient_name)
|
||||
if recipient_id is None:
|
||||
return "No user found. Make sure you typed it correctly."
|
||||
else:
|
||||
|
|
|
@ -37,7 +37,7 @@ 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')
|
||||
@patch('zulip_bots.bots.flock.flock.find_recipient_id')
|
||||
def test_no_recipient_found(self, find_recipient: str) -> None:
|
||||
bot_response = "No user found. Make sure you typed it correctly."
|
||||
find_recipient.return_value = None
|
||||
|
|
Loading…
Reference in a new issue