From f0d65a72ffd9e23864d3327f0961aa3998574d33 Mon Sep 17 00:00:00 2001 From: Albert Suralinski Date: Thu, 3 Dec 2020 10:02:25 +0100 Subject: [PATCH] PLINT-139 added default values for optional UserInfo dataclass parameters --- src/galaxy/api/types.py | 4 ++-- tests/test_friends.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/galaxy/api/types.py b/src/galaxy/api/types.py index 7fd0031..8443e79 100644 --- a/src/galaxy/api/types.py +++ b/src/galaxy/api/types.py @@ -166,8 +166,8 @@ class UserInfo: """ user_id: str user_name: str - avatar_url: Optional[str] - profile_url: Optional[str] + avatar_url: Optional[str] = None + profile_url: Optional[str] = None @dataclass diff --git a/tests/test_friends.py b/tests/test_friends.py index 9ce07db..8ccb0c0 100644 --- a/tests/test_friends.py +++ b/tests/test_friends.py @@ -18,7 +18,9 @@ async def test_get_friends_success(plugin, read, write): read.side_effect = [async_return_value(create_message(request)), async_return_value(b"", 10)] plugin.get_friends.return_value = async_return_value([ UserInfo("3", "Jan", "https://avatar.url/u3", None), - UserInfo("5", "Ola", None, "https://profile.url/u5") + UserInfo("5", "Ola", None, "https://profile.url/u5"), + UserInfo("6", "Ola2", None), + UserInfo("7", "Ola3"), ]) await plugin.run() plugin.get_friends.assert_called_with() @@ -30,7 +32,9 @@ async def test_get_friends_success(plugin, read, write): "result": { "friend_info_list": [ {"user_id": "3", "user_name": "Jan", "avatar_url": "https://avatar.url/u3"}, - {"user_id": "5", "user_name": "Ola", "profile_url": "https://profile.url/u5"} + {"user_id": "5", "user_name": "Ola", "profile_url": "https://profile.url/u5"}, + {"user_id": "6", "user_name": "Ola2"}, + {"user_id": "7", "user_name": "Ola3"}, ] } }