Skip to content

Commit 4cc8be8

Browse files
committed
SDK-2997: Add launch_platform_client method
1 parent f5eb32a commit 4cc8be8

5 files changed

Lines changed: 29 additions & 1 deletion

File tree

src/galaxy/api/consts.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class Feature(Enum):
9999
VerifyGame = "VerifyGame"
100100
ImportFriends = "ImportFriends"
101101
ShutdownPlatformClient = "ShutdownPlatformClient"
102+
LaunchPlatformClient = "LaunchPlatformClient"
102103

103104

104105
class LicenseType(Enum):

src/galaxy/api/plugin.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ def eof_handler():
107107
self._register_notification("shutdown_platform_client", self.shutdown_platform_client)
108108
self._detect_feature(Feature.ShutdownPlatformClient, ["shutdown_platform_client"])
109109

110+
self._register_notification("launch_platform_client", self.launch_platform_client)
111+
self._detect_feature(Feature.LaunchPlatformClient, ["launch_platform_client"])
112+
110113
self._register_method("import_friends", self.get_friends, result_name="friend_info_list")
111114
self._detect_feature(Feature.ImportFriends, ["get_friends"])
112115

@@ -657,6 +660,11 @@ async def shutdown_platform_client(self) -> None:
657660
This method is called by the GOG Galaxy Client."""
658661
raise NotImplementedError()
659662

663+
async def launch_platform_client(self) -> None:
664+
"""Override this method to launch platform client.
665+
This method is called by the GOG Galaxy Client."""
666+
raise NotImplementedError()
667+
660668
async def get_friends(self) -> List[FriendInfo]:
661669
"""Override this method to return the friends list
662670
of the currently authenticated user.

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def plugin(reader, writer):
4040
"achievements_import_complete",
4141
"get_local_games",
4242
"launch_game",
43+
"launch_platform_client",
4344
"install_game",
4445
"uninstall_game",
4546
"get_friends",

tests/test_features.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def test_base_class():
1313
Feature.ImportAchievements,
1414
Feature.ImportGameTime,
1515
Feature.ImportFriends,
16-
Feature.ShutdownPlatformClient
16+
Feature.ShutdownPlatformClient,
17+
Feature.LaunchPlatformClient
1718
}
1819

1920

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import pytest
2+
3+
from galaxy.unittest.mock import async_return_value
4+
5+
from tests import create_message
6+
7+
@pytest.mark.asyncio
8+
async def test_success(plugin, read):
9+
request = {
10+
"jsonrpc": "2.0",
11+
"method": "launch_platform_client"
12+
}
13+
14+
read.side_effect = [async_return_value(create_message(request)), async_return_value(b"")]
15+
plugin.launch_platform_client.return_value = async_return_value(None)
16+
await plugin.run()
17+
plugin.launch_platform_client.assert_called_with()

0 commit comments

Comments
 (0)