Skip to content

Commit c03465e

Browse files
committed
SDK-3145: Add optional profile and avatar url
1 parent 810a877 commit c03465e

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/galaxy/api/types.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ async def authenticate(self, stored_credentials=None):
6161
if not stored_credentials:
6262
return NextStep("web_session", PARAMS, cookies=COOKIES, js=JS)
6363
64-
:param auth_params: configuration options: {"window_title": :class:`str`, "window_width": :class:`str`, "window_height": :class:`int`, "start_uri": :class:`int`, "end_uri_regex": :class:`str`}
64+
:param auth_params: configuration options: {"window_title": :class:`str`, "window_width": :class:`str`,
65+
"window_height": :class:`int`, "start_uri": :class:`int`, "end_uri_regex": :class:`str`}
6566
:param cookies: browser initial set of cookies
66-
:param js: a map of the url regex patterns into the list of *js* scripts that should be executed on every document at given step of internal browser authentication.
67+
:param js: a map of the url regex patterns into the list of *js* scripts that should be executed
68+
on every document at given step of internal browser authentication.
6769
"""
6870
next_step: str
6971
auth_params: Dict[str, str]
@@ -158,9 +160,14 @@ class UserInfo:
158160
159161
:param user_id: id of the user
160162
:param user_name: username of the user
163+
:param avatar_url: the URL of the user avatar
164+
:param profile_url: the URL of the user profile
161165
"""
162166
user_id: str
163167
user_name: str
168+
avatar_url: Optional[str]
169+
profile_url: Optional[str]
170+
164171

165172
@dataclass
166173
class GameTime:

tests/test_friends.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ async def test_get_friends_success(plugin, read, write):
1717

1818
read.side_effect = [async_return_value(create_message(request)), async_return_value(b"", 10)]
1919
plugin.get_friends.return_value = async_return_value([
20-
UserInfo("3", "Jan"),
21-
UserInfo("5", "Ola")
20+
UserInfo("3", "Jan", "https://avatar.url/u3", None),
21+
UserInfo("5", "Ola", None, "https://profile.url/u5")
2222
])
2323
await plugin.run()
2424
plugin.get_friends.assert_called_with()
@@ -29,8 +29,8 @@ async def test_get_friends_success(plugin, read, write):
2929
"id": "3",
3030
"result": {
3131
"friend_info_list": [
32-
{"user_id": "3", "user_name": "Jan"},
33-
{"user_id": "5", "user_name": "Ola"}
32+
{"user_id": "3", "user_name": "Jan", "avatar_url": "https://avatar.url/u3"},
33+
{"user_id": "5", "user_name": "Ola", "profile_url": "https://profile.url/u5"}
3434
]
3535
}
3636
}
@@ -64,7 +64,7 @@ async def test_get_friends_failure(plugin, read, write):
6464

6565
@pytest.mark.asyncio
6666
async def test_add_friend(plugin, write):
67-
friend = UserInfo("7", "Kuba")
67+
friend = UserInfo("7", "Kuba", avatar_url="https://avatar.url/kuba.jpg", profile_url="https://profile.url/kuba")
6868

6969
plugin.add_friend(friend)
7070
await skip_loop()
@@ -74,7 +74,12 @@ async def test_add_friend(plugin, write):
7474
"jsonrpc": "2.0",
7575
"method": "friend_added",
7676
"params": {
77-
"friend_info": {"user_id": "7", "user_name": "Kuba"}
77+
"friend_info": {
78+
"user_id": "7",
79+
"user_name": "Kuba",
80+
"avatar_url": "https://avatar.url/kuba.jpg",
81+
"profile_url": "https://profile.url/kuba"
82+
}
7883
}
7984
}
8085
]

0 commit comments

Comments
 (0)