Skip to content

Commit f0d65a7

Browse files
Albert Suralinskimbanczerowski
Albert Suralinski
authored andcommitted
PLINT-139 added default values for optional UserInfo dataclass parameters
1 parent 96cb48f commit f0d65a7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/galaxy/api/types.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ class UserInfo:
166166
"""
167167
user_id: str
168168
user_name: str
169-
avatar_url: Optional[str]
170-
profile_url: Optional[str]
169+
avatar_url: Optional[str] = None
170+
profile_url: Optional[str] = None
171171

172172

173173
@dataclass

tests/test_friends.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ async def test_get_friends_success(plugin, read, write):
1818
read.side_effect = [async_return_value(create_message(request)), async_return_value(b"", 10)]
1919
plugin.get_friends.return_value = async_return_value([
2020
UserInfo("3", "Jan", "https://avatar.url/u3", None),
21-
UserInfo("5", "Ola", None, "https://profile.url/u5")
21+
UserInfo("5", "Ola", None, "https://profile.url/u5"),
22+
UserInfo("6", "Ola2", None),
23+
UserInfo("7", "Ola3"),
2224
])
2325
await plugin.run()
2426
plugin.get_friends.assert_called_with()
@@ -30,7 +32,9 @@ async def test_get_friends_success(plugin, read, write):
3032
"result": {
3133
"friend_info_list": [
3234
{"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"}
35+
{"user_id": "5", "user_name": "Ola", "profile_url": "https://profile.url/u5"},
36+
{"user_id": "6", "user_name": "Ola2"},
37+
{"user_id": "7", "user_name": "Ola3"},
3438
]
3539
}
3640
}

0 commit comments

Comments
 (0)