Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #176 from beproud/t173
Browse files Browse the repository at this point in the history
#173 エンバグ修正
  • Loading branch information
wanshot authored Mar 4, 2019
2 parents b14891b + ad44a40 commit ebec926
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/haro/slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def get_user_name(user_id):
"""
users = get_users_info()
profile = users.get(user_id)
if not profile:
return
return profile['name']


Expand Down
10 changes: 10 additions & 0 deletions tests/test_slack.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ def test_get_user_name(self, target):

assert name == actual

def test_get_user_name_with_none(self, target):
"""存在しないユーザー名であればNoneが返る事
"""
user_id = 'U41NH7LFJ'

with patch('haro.slack.get_users_info', return_value={}):
actual = target(user_id)

assert None is actual


class TestGetUserDisplayName:

Expand Down

0 comments on commit ebec926

Please sign in to comment.